//完全照搬筛法代码,输出prime[k-1]即可
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
const int maxn = 1e5 + 10;
bool isprime[maxn];
vector<int>prime;
void initial() {
for (int i = 0; i < maxn; i++) {
isprime[i] = true;
}
isprime[0] = false;
isprime[1] = false;
for (int i = 2; i < maxn; i++) {
if (!isprime[i]) {
continue;
}
prime.push_back(i);
for (int j = i * i; j < maxn; j += i) {
isprime[j] = false;
}
}
}
int main() {
initial();
int k;
while (scanf("%d", &k)!=EOF) {
printf("%d\n", prime[k - 1]);
}
return 0;
}