def check_num(n): ok1=True ok2=False for i in range(1,int(n**0.5)+1): if n%i==0: if 2<=i<=100000: ok1=False break for i in range(2,int(n**0.5)+1): if n%i==0: ok2=True break return True if ok1==True and ok2==True else False N=int(input()) a=[1] for i in range(10**5,10**5+10001): if check_num(i):a.append(i) print(a[N-1])