import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) U = 10**5 + 1000 is_prime = np.zeros(U, np.bool_) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, U, 2): if p * p > U: break if is_prime[p]: is_prime[p * p::p + p] = 0 primes = np.where(is_prime)[0] primes = primes[primes > 10**5] se = set(x * y for x in primes for y in primes) se.add(1) nums = sorted(se)[:10] print(nums[N - 1])