#include <iostream>
#include <fstream>
#include <string.h>
//#include <vector>
//#include <queue>
//#include <algorithm>
using namespace std;
const int nmax = 1300000;
char s[nmax*2];
int main(){
int k, nrP = 0;
unsigned long long p = 1, t;
freopen("prim.in", "r", stdin);
freopen("prim.out", "w", stdout);
scanf("%d", &k);
memset(s, 0, sizeof(s));
while (nrP < k){
p++;
for (; s[p] == 1; p++);
nrP++;
if (p < 45000)
t = p*p;
for (; t < nmax; t += p) s[t] = 1;
}
p++;
for (; s[p] == 1; p++);
long long res = p * p;
printf("%lld ", res);
fclose(stdin);
fclose(stdout);
return 0;
}