// CPP program to the nth prime number
#include <bits/stdc++.h>
using namespace std;
// initializing the max value
#define MAX_SIZE 10000005
void SieveOfEratosthenes(vector &primes)
{
bool IsPrime[MAX_SIZE];
memset(IsPrime, true, sizeof(IsPrime));
for(int i = 4;i<MAX_SIZE;i+=2)
IsPrime[i] = false;
for (int p = 3; p * p < MAX_SIZE; p+=2)
{
if (IsPrime[p] == true)
{
for (int i = p * p; i < MAX_SIZE; i += p)
IsPrime[i] = false;
}
}
IsPrime[0] = false;
IsPrime[1] = false;
IsPrime[2] = true;
// Store all prime numbers
for (int p = 2; p < MAX_SIZE; p++)
if (IsPrime[p])
primes.push_back(p);
}
// Driver Code
int main()
{
// To store all prime numbers
vector primes;
// Function call
SieveOfEratosthenes(primes);
int n;
cin>>n;
cout<<primes[n];
return 0;
}