Problem10363--ABC327 —— B - A^A

10363: ABC327 —— B - A^A

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

You are given an integer $B$.  
If there exists a positive integer $A$ such that $A^A = B$, print its value; otherwise, output `-1`.

Input

The input is given from Standard Input in the following format:

```
$B$
```

Output

If there exists a positive integer $A$ such that $A^A = B$, print its value; otherwise, print `-1`.  
If there are multiple positive integers $A$ such that $A^A = B$, any of them will be accepted.

Constraints

-   $1 \leq B \leq 10^{18}$
-   $B$ is an integer.

Sample 1 Input

27

Sample 1 Output

3
$3^3=27$, so print 3.

Sample 2 Input

100

Sample 2 Output

-1
There is no $A$ such that $A^A=B$.

Sample 3 Input

10000000000

Sample 3 Output

10

Source/Category