#include <fstream>
#include <iostream>
bool era[3000000];
using namespace std;
int eratos(int x)
{
    for (int i = 0; i < x; i++)
{
    era[i] = true;
}
    era[1] = false;
    era[0] = false;
    for (int i = 2; i*i <= x; i++)
    {
        if (era[i] == true)
        {
            for (int j = i*i; j <= x; j += i)
            {
                era[j] = false;
            }
        }
    }
    return 0;
}
int main()
{
    ifstream fi("Prime.inp");
    ofstream fo("prime.out");
    int n,d = 1;
    fi >> n;
    eratos(3000000);
    if (n == 1) {fo << 2;}
    else
    {
       for (int i = 3; i < 3000000; i += 2)
       {
           if (era[i] == true) d++;
           if (d == n) {fo << i; break;}
       }
    }
    return 0;
}
