#include <fstream>
#include <vector>
#include <math.h>

using namespace std;

bool isPrime(long long a)
{
	if (a < 2)
	{
		return 0;
	}
	if (a == 2 || a == 3)
	{
		return 1;
	}
	if (a % 6 != 1 && a % 6 != 5)
	{
		return 0;
	}
	for (int i = 2; i <= sqrt(a); i++)
	{
		if (a % i == 0)
		{
			return 0;
		}
	}
	return 1;
}

int main()
{
	ifstream input("prime.inp");
	ofstream output("prime.out");

	long long n;
	input >> n;

	int i = 1;
	int j = 2;
	while (i <= n)
	{
		if (isPrime(j) == 1)
		{
			i++;
		}
		j++;
	}
	output << j - 1;
	input.close();
	output.close();
	return 0;
}