#include <bits/stdc++.h>
using namespace std;
bool pd(int x){
if(x == 1) return false;
if(x == 2 || x == 3 || x == 5) return true;
for(int i = 2; i < x; i++) if(x % i == 0) return false;
return true;
}
int main(){
int n, tmp = 1;
scanf("%d", &n);
for(int i = 1; true ; i++){
if( pd(i) && tmp == n ){
printf("%d", i);
return 0;
}
++tmp;
}
return 0;
}