Time Limit: Java: 10000 ms / Others: 10000 ms

Memory Limit: Java: 32768 KB / Others: 32768 KB

George likes arithmetics very much. Especially he likes the natural numbers
series. His most favourite thing is the infinite sequence of digits, which results
as the concatenation of all natural numbers in ascending order. The beginning
of this sequence is 1234567891011121314... Let us call this sequence S. Then
S[1] = 1, S[2] = 2, ..., S[10] = 1, S[11] = 0, ... , and so on.

George takes a sequence of digits A and wants to know when it first appears
in S. Help him to solve this difficult problem.

The first line of the input file contains A - the given sequence of digits. The number of digits in A does not exceed 200.

Process to the end of file.

提交代码