#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; int C = 100000; bool prime(ll i){ for(ll j=2;j*j<=i;j++){ if(i%j==0) return false; } return true; } int main(){ int n; cin >> n; if(n==1){ cout << 1 << endl; return 0; } vector p; rep(i,100)rep(j,100){ ll a = C + i + 1; ll b = C + j + 1; if(prime(a) && prime(b)){ p.push_back(a*b); } } sort(p.begin(),p.end()); p.erase(unique(p.begin(),p.end()),p.end()); //cout << p.size() << endl; cout << p[n-2] << endl; return 0; }