import math def main(): n = int(input()) a = [1] b = [] for i in range(1000001, 10000000): flg = True for j in (2,math.sqrt(i)): if i % j == 0: flg = False break if flg: b.append(i) if len(b) == 10: break for i in range(len(b)): for j in range(1,10): a.append(b[i] * j) a.sort() print(a[n - 1]) main()