Champernowne Verification

시간 제한1초메모리 제한2048 MB

문제

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$.