#include #include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0,_i=(n);i<_i;++i) templateusing priority_queue_rev = priority_queue, greater>; int main() { int N; cin >> N; if (N == 1) { cout << 1 << endl; return 0; } priority_queue_rev q; int v[] = {10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079}; rep(i, 8) rep(j, 8) { if (j < i) continue; q.push(1LL * v[i] * v[j]); } rep(i, N-2) q.pop(); cout << q.top() << endl; return 0; }