import sys input = sys.stdin.readline x=10**5 import math L=math.floor(math.sqrt(x)) # 平方根を求める Primelist=[i for i in range(x+1)] Primelist[1]=0 # 1は素数でないので0にする. for i in Primelist: if i>L: break if i==0: continue for j in range(2*i,x+1,i): Primelist[j]=0 Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0] SET_Primes=set(Primes) ANS=[1] for i in range(10**10+1,2*10**10): for j in SET_Primes: if i%j==0: break else: ANS.append(i) if len(ANS)==10: break print(ANS[int(input())-1])