#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 n,j;
	snt[0] = snt[1] = false;
	for(int i =2;i<=max; i++)
	{
		if(snt[i])
		{
			for(j=i*2;j<=max;j+=i)
			{
				snt[j]= false;
			}
		}
	}
	j=0;
	for(int i =2;i<max;i++)
	{
		if(snt[i])
		{
			j++;p[j]=i;
		}
	}
	freopen("prime.inp", "r", stdin);
	freopen("prime.out", "w", stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i==n)
		{	
			cout<<p[i];
		}
	}
}
