#include<iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include<vector>
#include<cmath>
using namespace std;

const int INF = 1e6;
bool isPrime(int number)
{
	for (int i = 2; i <= sqrt(number); i++)
	{
		if (number % i == 0)
		{
			return false;
		}
	}
	return true;
}

int main() 
{
	int n_count = 0;
	vector<int>result_list;
	for (int i = 2; i < INF; i++)
	{
		if (isPrime(i))
		{
			result_list.push_back(i);
		}
	}
	int K;
	while (scanf("%d", &K)!=EOF)
	{
		printf("%d\n", result_list[K-1]);
	}


}