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) >= 5: break tt = set() for i in range(5): for j in range(5): tt.add(t[i] * t[j]) for i in range(1, 5): tt.discard(t[i]) tt = sorted(tt) print(tt[N - 1])