n = int(input()) if n == 1: print(1) exit() IsPrime = [True for _ in range(10**6 + 1)] IsPrime[0] = IsPrime[1] = False for i in range(2, 10**6 + 1): if IsPrime[i]: for j in range(i + i, 10**6 + 1, i): IsPrime[j] = False rank = 1 for i in range(10**5 + 1, 10**6 + 1): if IsPrime[i]: rank += 1 if rank == 2: prev = i if rank == n: print(i * prev) break