#include
using namespace std;
const int len = 50000;
int main() {
int arr[5000] = {0};
for (int i = 2; i < 5000; i++) {
for (int j = i * i; j < 30; j+=i) {
arr[j - 1] = 1;
}
}
int k=2;
int arr2[3000]={0};
arr2[1]=2;
for (int i = 1; i < 3000; i++) {
if (arr[i]!=0)
{
arr2[k]=i;
k++;
}
}
int n;
cin>>n;
cout<<arr2[n];
return 0;
}