Escalator
InterviewTime limit1sMemory limit512 MB
Given n, sum the decimal digit counts of the numbers 1, n, and every multiple of 10 up to n.
- Level
Medium4 of 10
- Topics
- Math, Implementation, Number theory
- Solved
- No attempts yet
Problem
A new metro station is opening in Saint Petersburg, and an escalator must be produced for it. The escalator consists of steps, numbered with the integers from to . By tradition, the step numbers are written on the steps whose numbers are multiples of ten, as well as on the first and the last step. Writing a number uses the same amount of paint for each digit written.
To calculate the amount of paint needed, you have to know how many digits will be written. Write a program that determines the total number of digits used in the numbers of the labeled steps.
Input
The input file contains a single integer , the number of steps of the escalator ().
Output
Output the total number of digits in the numbers of the labeled steps.
Hint
In the first example, numbers are written on steps 1, 10, 20; in the second, on 1, 10, 20, 23.