def primes(n): memo = [True] * (n + 1) i = 2 while i * i <= n: if memo[i]: j = i << 1 while j <= n: memo[j] = False j += i i += 1 return [i for i in range(n + 1) if memo[i] and i >= 10 ** 5 + 1] from itertools import combinations_with_replacement N = int(input()) P = primes(10 ** 6)[:N] A = [1] + sorted(x * y for x, y in combinations_with_replacement(P, 2)) print(A[N - 1])