nnnnn
Time limit2sMemory limit512 MB
Given L equal to n times the digit length of n, recover n for L up to a 10^6-digit number.
- Level
Medium5 of 10
- Topics
- Math, Binary search, Implementation, String matching
- Solved
- No attempts yet
Problem
Hsara and Simone send each other messages that nobody else can read. This time Simone invented a sneaky cipher. To send Hsara a non-negative integer , she encrypts it as follows.
Let be the decimal expansion of . Write down times in a row and call the resulting string . The encryption of is the length of .
Take . Then , which has length , so the encryption of is .
For the string is empty, so the encryption of is .
Hsara wrote a decryption program without any trouble. Can you?
Input
The first and only line contains an integer (), the encryption of some non-negative integer .
Output
Print one line containing the integer .