#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> #include<string> using namespace std; int main() { long long a; cin >> a; vector<long long> v; if (a < 7) cout << a << endl; else if (a <= 9) cout << 6 << endl; else if (a <= 16) cout << 8 << endl; else { for (int i = 3; i < 120; i++){ for (int j = 2; j < 60; j++){ if (pow(i, j) >= a) v.push_back(i*j); } } sort(v.begin(), v.end()); cout << v[0] << endl; } }