If you wrote all of the whole numbers from 1 though 10000, how many times would you write the digit 5?

(Source: Adapted from Mathematics Teaching in the Middle School, Jan-Mar 1995)