N = int(input()) if N==1: print(1) exit() def is_prime(n): if n == 2: return True if n < 2 or n%2 == 0: return False m = 3 while m*m <= n: if n%m == 0: return False m += 2 return True arr = [] for n in range(100001, 100100): if is_prime(n): arr.append(n) arr2 = [] for a in arr: for b in arr: arr2.append(a*b) print(sorted(set(arr2))[N-2])