100 #ABC097B. [ABC097B] Exponential

[ABC097B] Exponential

Score : 200200 points

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 \leq XX \leq 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.

10
9

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

1
1
999
961