#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using ll = long long; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; const ll mod = 1e9 + 7; vector prime_table(int n) { vector prime(n + 1, true); if (n >= 0) prime[0] = false; if (n >= 1) prime[1] = false; for (int i = 2; i * i <= n; i++) { if (!prime[i]) continue; for (int j = i + i; j <= n; j += i) { prime[j] = false; } } return prime; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; if (n == 1) { cout << 1 << "\n"; return 0; } vector tb = prime_table(1000000); vector prime; for (int i = 0; i < tb.size(); i++) { if (tb[i] == true) { prime.push_back(i); } } auto ini = lower_bound(prime.begin(), prime.end(), 100000); vector prime2; for (int i = (ini - prime.begin()); i < (ini - prime.begin()) + n; i++) { prime2.push_back(prime[i]); } vector product; for (int i = 0; i < prime2.size(); i++) { for (int j = i; j < prime2.size(); j++) { product.push_back((ll)prime2[i] * (ll)prime2[j]); } } sort(product.begin(), product.end()); cout << product[n - 2] << "\n"; }