#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair pll; typedef pair pint; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; if (N == 1) { cout << 1 << endl; return 0; } N -= 1; int MAX = pow(10, 6); vector is_prime(MAX, 1); is_prime[0] = 0, is_prime[1] = 0; for (int i = 2; i < MAX; ++i) { if (!is_prime[i]) continue; for (int j = 2 * i; j < MAX; j += i) { is_prime[j] = 0; } } vector ans, res; int cnt = 0; for (ll i = pow(10, 5) + 1; i < MAX; i++) { if (is_prime[i]) { ans.push_back(i); cnt++; } if (cnt == 15) { break; } } for (int i = 0; i < ans.size(); i++) { for (int j = i + 1; j < ans.size(); j++) { res.push_back(ans[i] * ans[j]); } } sort(all(res)); cout << res[N - 1] << endl; }