from bisect import bisect_left def primes(n): m = n*2 is_prime = [True] * (m + 1) is_prime[0] = False is_prime[1] = False for i in range(2, int(m**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, m + 1, i): is_prime[j] = False return [i for i in range(m + 1) if is_prime[i]] N = int(input()) ans = 0 if N == 1: ans = 1 else: l = primes(10**5) b = bisect_left(l,10**5+1) l = l[b:b+11] ansList = [] for i in range(len(l)): for j in range(len(l)): ansList.append(l[i]*l[j]) ansList = list(set(ansList)) ansList.sort() ans = ansList[N-2] print(ans)