n = int(input()) if n == 1: print(1) exit() n -= 2 IsPrime = [True for _ in range(10**6 + 1)] IsPrime[0] = IsPrime[1] = False for i in range(2, 10**6 + 1): if IsPrime[i]: for j in range(i + i, 10**6 + 1, i): IsPrime[j] = False P = [] for i in range(10**5 + 1, 10**6 + 1): if IsPrime[i]: P.append(i) if len(P) == 5: break ANS = [] for i in range(5): for j in range(i, 5): ANS.append(P[i] * P[j]) ANS.sort() print(ANS[n])