import sys input = sys.stdin.readline N = int(input()) if N == 1: print(1) exit(0) table = [1] * (10 ** 6) for i in range(2, 10 ** 5 + 1): for j in range(i, 10 ** 6, i): table[j] = 0 t = [] for i in range(2, 10 ** 6): if table[i]: t.append(i) if len(t) >= 10: break tt = [] for i in range(10): for j in range(i, 10): tt.append(t[i] * t[j]) tt.sort() print(tt[N - 2])