x=int(input()) x-=1 if x == 0: print(1) exit() def c(n): sosu=[True]*(n+1) sosu[0],sosu[1] = False,False cnt=0 for i in range(4,n+1,2): sosu[i] = False for i in range(3,int(n**0.5)+1,2): if sosu[i] == False: continue for j in range(i,n//i+1,2): sosu[j*i]=False return [p for p in range(n + 1) if sosu[p]==True] n=10**6 t=c(n) cnt=0 for i in range(len(t)): if t[i] > 10**5: cnt+=1 if cnt == x: print(t[i]**2) break