시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 512 MB 0 0 0 0.000%

문제

Champernowne constant is an irrational number. Its decimal representation starts with “0.”, followed by concatenation of all positive integers in the increasing order.

You will be given a sequence S which consists of decimal digits. Your task is to write a program which computes the position of the first occurrence of S in Champernowne constant after the decimal point.

입력

The input has multiple test cases. Each line of the input has one digit sequence. The input is terminated by a line consisting only of #.

It is guaranteed that each sequence has at least one digit and its length is less than or equal to 100.

출력

For each sequence, output one decimal integer described above. You can assume each output value is less than 1016 .

예제 입력 1

45678
67891011
21
314159265358979
#

예제 출력 1

4
6
15
2012778692735799