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