#abc327b. B - A^A

B - A^A

Score : 200200 points

问题描述

给定一个整数 BB

如果存在一个正整数 AA,使得 AA=BA^A = B,则输出 AA 的值;否则,输出 -1

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

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

Constraints

  • 1B10181 \leq B \leq 10^{18}
  • BB is an integer.

Input

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

BB

Output

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

Sample Input 1

27

Sample Output 1

3

33=273^3 = 27, so print 33.

Sample Input 2

100

Sample Output 2

-1

There is no AA such that AA=BA^A = B.

Sample Input 3

10000000000

Sample Output 3

10

update @ 2024/3/10 01:50:34