N = int(input()) import math def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True Prime = [] count = 0 for i in range(10**5 + 1, 10**6, 2): if is_prime(i) == True: Prime.append(i) count += 1 if count > 3: break else: pass else: pass Ans = [1] for i in range(3): for j in range(3): Ans.append(Prime[i] * Prime[j]) print(Ans[N-1])