#include <bits/stdc++.h>
#define max 10000000
using namespace std;
int main()
{
	vector<bool> snt(max+1,true);
	vector <int> p(max+1,0);
	int i,j,n;
	snt[0] = snt[1] = false;
	for(i = 2; i <= max; i++) {
        if (snt[i]) {
            for(j = i*2; j <= max; j+=i) {
                snt[j] = false;
            }
        }
    }
    j=0; 
    for(i=2;i<max;i++)
      if (snt[i]) 
        {j++;p[j]=i;}
	ifstream fi("prime.inp");
	ofstream fo("prime.out");
	fi>>n;
//	for (i=1;i<=n;i++) cout<<p[i]<<" ";
	fo<<p[n];   
    fo.close();fi.close();   
	return 0;
}

