시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 2048 MB103175869473.908%

문제

The $k^{\text{th}}$ Champernowne word is obtained by writing down the first $k$ positive integers and concatenating them together. For example, the $10^{\text{th}}$ Champernowne word is $12345678910$.

Given a positive integer $n$, determine if it is a Champernowne word, and if so, which word.

입력

The first line contains a single integer, $n$ ($1 \le n \le 10^9$). $n$ will not have leading zeroes.

출력

If $n$ is the $k^{\text{th}}$ Champernowne word, output $k$. Otherwise, output $-1$.

예제 입력 1

123456789

예제 출력 1

9

예제 입력 2

1000000000

예제 출력 2

-1

예제 입력 3

11

예제 출력 3

-1

예제 입력 4

1324

예제 출력 4

-1