KTH Challenge 2016 Open

Start

2016-06-12 10:00 CEST

KTH Challenge 2016 Open

End

2016-06-12 14:00 CEST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -376 days 4:02:20

Time elapsed

4:00:00

Time remaining

0:00:00

Problem H
nnnnn

Hsara and Simone like to communicate without anyone else knowing what they’re saying. This time, Simone invented a very sneaky cipher. When she wants to tell Hsara a non-negative number $n$, she performs the following encryption procedure.

Let $d(n)$ denote the decimal expansion of $n$. Consider the string $x := d(n)^ n$, i.e., the decimal expansion of $n$ concatenated with itself $n$ times. The encryption of $n$ is then the length of $x$.

As an example, assume Simone wants to encrypt the number $10$. Then

\[ x = 10101010101010101010. \]

The length of $x$ is then $20$, which will be the encrypted value of $x$.

Hsara had no problem writing a decryption algorithm for this procedure. But can you?

Input

The first and only line contains an integer $L$ ($0 \leq L \leq 10^{{10}^6}$), the encrypted value of some non-negative integer $n$.

Output

Output a single line containing the integer $n$.

Sample Input 1 Sample Output 1
20
10