#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;
int main(){
	int n;
	vector<int>vec;
	for (int i = 2; vec.size() < 10000; i++){
		int m = sqrt(i);
		int j = 2;
		for (; j <= m; j++){
			if (i%j == 0){
				break;
			}
		}
		if (j>m){
			vec.push_back(i);
		}
	}
	while (scanf("%d", &n) != EOF){
		printf("%d\n", vec[n - 1]);
	}
}