#include #define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i)) #define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typedef unsigned long long ulint; typedef pair pii; typedef pair pll; template bool chmax(T &a, const T &b){if(a bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;} template T div_floor(T a, T b){ if(b < 0) a *= -1, b *= -1; return a>=0 ? a/b : (a+1)/b-1; } template T div_ceil(T a, T b){ if(b < 0) a *= -1, b *= -1; return a>0 ? (a-1)/b+1 : a/b; } constexpr lint mod = 1e9+7; constexpr lint INF = mod * mod; constexpr int MAX = 1000010; vector min_factor, prime; void sieve(int n){ min_factor.resize(n+1, 0); For(i, 2, n+1){ if(min_factor[i] == 0){ min_factor[i] = i; prime.push_back(i); } for(int x: prime){ if(x*i > n || x > i) break; min_factor[x*i] = x; } } } vector prime_f(int n){ vector ret; while(n > 1){ if(ret.empty() || ret.rbegin()->fi != min_factor[n]){ ret.emplace_back(min_factor[n], 1); } else ++ret.rbegin()->se; n /= min_factor[n]; } return ret; } bool is_prime(int n){ return min_factor[n] == n; } int main(){ int n; scanf("%d", &n); sieve(MAX); auto cmp = [&](const pii &p1, const pii &p2){ return prime[p1.fi] * prime[p1.fi] > prime[p2.fi] * prime[p2.fi]; }; priority_queue, decltype(cmp)> que(cmp); int a = lower_bound(prime.begin(), prime.end(), 100003) - prime.begin(); que.emplace(a, a); vector v; v.push_back(1); while(v.size() < 100){ auto [s, t] = que.top(); que.pop(); v.push_back((lint)prime[s] * prime[t]); if(s+1 < MAX) que.emplace(s+1, t); if(t+1 < MAX) que.emplace(s, t+1); } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); printf("%lld\n", v[n-1]); }