import sys import itertools sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def is_prime(n): if n == 1: return False for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False return True def main(): N = int(input()) prime = [] for i in range(10 ** 5 + 1, 10 ** 6): if is_prime(i): prime.append(i) if len(prime) == 10: break x = [] x.append(1) for a, b in itertools.combinations(prime, 2): x.append(a * b) x.sort() print(x[N - 1]) if __name__ == '__main__': main()