#abc097b. [abc097_b]Exponential

[abc097_b]Exponential

Problem Statement

You are given a positive integer XX. Find the largest perfect power that is at most XX. Here, a perfect power is an integer that can be represented as bpb^p, where bb is an integer not less than 11 and pp is an integer not less than 22.

Constraints

  • 11 XX 10001000
  • XX is an integer.

Input

Input is given from Standard Input in the following format:

XX

Output

Print the largest perfect power that is at most XX.


Sample Input 1

10

Sample Output 1

9

There are four perfect powers that are at most 1010: 11, 44, 88 and 99. We should print the largest among them, 99.


Sample Input 2

1

Sample Output 2

1

Sample Input 3

999

Sample Output 3

961