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) p=[] cnt=0 for i in range(len(t)): if t[i] > 10**5: p.append(t[i]) cnt+=1 if cnt == 10: break ans=[] for i in range(len(p)-1): for j in range(i,len(p)): ans.append(p[i]*p[j]) ans.sort() print(ans[x-1])