def sieve(n): res = [True for _ in range(n + 1)] res[0] = False res[1] = False i = 2 while i * i <= n: if res[i]: for j in range(i * 2, n + 1, i): res[j] = False i += 1 return res S = sieve(101000) P = [p for p in range(101000) if S[p] and p > 100000] Q = [1] for i in range(10): for j in range(10): Q.append(P[i] * P[j]) Q.sort() print(Q[int(input()) - 1])