N = int(input()) M = 10**5 L = [0]*(10*M+1) L2 = [] for i in range(2, 3*M+1): if L[i] == 0: j = 1 while i*j <= 3*M: L[i*j] = 1 j += 1 if i > M: L2.append(i) if len(L2) > N: break ans = [1] for i in range(N): for j in range(N): ans.append(L2[i]*L2[j]) ans.sort() print(ans[N-1])