#include <iostream>
using namespace std;
bool isPrim(int n){
if (n!=2 && n%2==0) return false;
if (n != 3 && n%3==0) return false;
int i=5; int in=2;
while (i*i<n){
if (n%i==0) return false;
i=i+in;
in=6-in;
} return true;
}
int main(){
int x,y,z;
cin>>x;
y=0;
z=1;
while (y<x){
z++; // inceput este 2
if (isPrim(z))
y++;
}
cout << z;
return 0;
}