import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from itertools import combinations def eratosthenes(n): prime_list = [True] * (n + 1) prime_list[0] = False prime_list[1] = False for i, prime in enumerate(prime_list[2:int(n ** 0.5) + 1]): if prime: for j in range(pow(i + 2, 2), n + 1, i + 2): prime_list[j] = False return prime_list n = int(readline()) ans = [1] memo = [0] * (n + 1) idx = 0 for i, j in enumerate(eratosthenes(10 ** 5 + 10 ** 3)): if j and i > 10 ** 5: memo[idx] = i idx += 1 if idx == n + 1: break for comb in combinations(memo, 2): ans.append(comb[0] * comb[1]) ans.sort() print(ans[n - 1])