N = int(input()) import sys if N == 1: print(1) exit() dat = [0] * 10 ** 6 C = 10 ** 6 prime = [] for i in range(2,C): if dat[i] == 0: for j in range(i*2,C,i): dat[j] = 1 if i > 10 ** 5: prime.append(i) l = [] for i in range(4): for j in range(i,4): l.append(prime[i] * prime[j]) l.sort() print(l[N-2])