/*
Requirements:
output the kth prime number
*/

#include <iostream>
#include <cmath>

using namespace std;


bool isPrime(int n) {
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (!(n % 6 == 1 || n % 6 == 5)) return false;
    for (int i = 3; i <= floor((sqrt(n) + 1)); i += 2) {
        if (n % i == 0)
            return false;
    }
    return true;
}


int main()
{
    int count = 1;
    int num = 1;
    int k = 0;
    while (cin >> k) {
        if (k == 1) {
            cout << 2 << endl;
            continue;
        }
        while (count < k) {
            num += 2;
            if (isPrime(num))
                count++;
        }
        cout << num << endl;
    }
    return 0;
}