#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
//エラトステネスの篩
vector<bool> IsPrime(1000010,true);
void sieve(ll n){
    IsPrime[0]=0;
    IsPrime[1]=0;
    REP(i,2,n+1){
        if(IsPrime[i]){
            ll k=2;
            while(k*i<=n){
                IsPrime[k*i]=0;
                k++;
            }
        }
    }
}
signed main(){
    ll cnt=0;
    ll n;cin>>n;
    sieve(1000000);
    vector<ll>d(0);
    rep(i,1000000){
        if(d.size()==10)break;
        if(IsPrime[i]&&i>100000)d.pb(i);
    }
    vector<ll>ans(0);
    rep(i,d.size()){
        REP(j,i,d.size())ans.pb(d[i]*d[j]);
    }
    ans.pb(1);
    sort(all(ans));
    cout<<ans[n-1]<<endl;
}