#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; vector IsPrime; void sieve(ll max) { if(max + 1 > IsPrime.size()) { // resizeで要素数が減らないように IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保 } IsPrime[0] = false; // 0は素数ではない IsPrime[1] = false; // 1は素数ではない for(ll i = 2; i * i <= max; ++i) { // 0からsqrt(max)まで調べる if(IsPrime[i]) { // iが素数ならば for(ll j = 2; i * j <= max; ++j) { // (max以下の)iの倍数は IsPrime[i * j] = false; // 素数ではない } } } } int main() { ll n; cin >> n; if(n == 1) { cout << 1 << endl; } else { int cnt = 0; vector ans; int a = 100000; sieve(1000000); while(cnt <= 10) { if(IsPrime[a]) { cnt++; ans.push_back(a); } a++; } cout << ans[0] * ans[n - 2] << endl; } return 0; }