import sys input = sys.stdin.readline N = int(input()) 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(1, 10 ** 6): if table[i]: t.append(i) if len(t) >= 4: break tt = [] for i in range(4): for j in range(4): tt.append(t[i] * t[j]) tt.sort() print(tt[N - 1])