cifra
Gigel has just started learning in school how to write positive integers, one by one. Delighted by the new knowledge he's receiving, Gigel wants to write each new number he learns on a piece of paper. Being very zealous, Gigel writes each time on the piece of paper not only the last number he learned in school but also all the positive integers he learned that far. Moreover, Gigel also wants to protect the forests, by saving paper, and decides to write all the numbers he learned one by one, with no spaces between them, on a single piece of paper. For this reason, at a certain moment, Gigel's piece of paper will contain a single number, with many digits, as written below:
112123123412345123456123456712345678123456789123456789101234567891011...
After several days, looking at his piece of paper, Gigel notices he can't figure out fast enough what number a specific digit belongs to.Task
Being given a positive integer n, determine the number the digit located on position n belongs to.
Input Data
Input file cifra.in contains on line one number n.
Output Data
Output file cifra.out will contain a single line with the requested number.
Restrictions
1 <= n <= 200 000 000
The positions are numbered starting with 1.
Example
cifra.in |
cifra.out |
67 |
10 |
lect. drd. Radu Boriga
"Titu Maiorescu" University - Bucharest
Contact:r_boriga@yahoo.com