#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } const long long INF = 1e18; //const ll mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; vector v; vector p; v.push_back(1); for(ll i = 1e5; i <= 3e5; i++) { bool ok = true; for(ll j = 2; j * j <= i; j++) { if(i % j == 0) ok = false; } if(ok) p.push_back(i); } for(ll i = 0; i < 20; i++) { for(ll j = i; j < 20; j++) { v.push_back(p[i] * p[j]); } } sort(v.begin(), v.end()); cout << v[N-1] << endl; return 0; }