#include using namespace std; using ll = long long; constexpr char newl = '\n'; template vector sieve(T n) { vector res; vector is_prime(n + 1, true); is_prime[0] = false; is_prime[1] = false; for (T i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.emplace_back(i); for (T j = 2 * i; j <= n; j += i) is_prime[j] = false; } return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); vector v = sieve(200000LL); int n; cin >> n; if (n == 1) { cout << 1 << newl; return 0; } int j = upper_bound(v.begin(), v.end(), 100000) - v.begin(); --n; vector v2; for (int i = j; i < j + 10; i++) { for (int k = j; k <= i; k++) { v2.push_back(v[i] * v[k]); } } sort(v2.begin(), v2.end()); cout << v2[n-1] << newl; return 0; }