#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;

#define all(x)  x.begin(),x.end()
#define v(x) vector<x>
#define nl '\n'
#define fxd(x) fixed << setprecision(x)
template<class t> using ordered_set = tree<t, null_type, less<t>, rb_tree_tag, tree_order_statistics_node_update>;
template<class t> using ordered_multiset = tree<t, null_type, less_equal<t>, rb_tree_tag, tree_order_statistics_node_update>;

ll nthprime(ll n)
{
    vector<bool> nums(10000000,true);
    ll cnt = 0;
    ll sz = nums.size() -1;
    for (ll i = 2; i <= sz; i++)
    {
        if(nums[i])
        {
            cnt++;
            if(cnt == n)
            {
                return i;
            }
            for (ll j = i*i; j <= sz; j+=i)
            {
                nums[j] = false;
            }
            
        }
    }
    return -1;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    ll n ; cin >> n;
    cout << nthprime(n);
}