#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
#define max 1000000

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]==true)
    {
        for (j=i*2;j<=max;j+=i)
        {snt[j]=false;}
    }
}
j=0;
for (i=2;i<max;i++)
    {if (snt[i]==true)
{
    j++;
    p[j]=i;
}}
ifstream f1("PRIME.INP");
ofstream f2("PRIME.OUT");
f1>>n;
f1.close();
f2<<p[n];
f2.close();
    return 0;
}
