X = [100003, 100019, 100043, 100049, 100057, 100069, 100103, 100109, 100129] x = [] for i in range(9): for j in range(i + 1): x += [X[i] * X[j]] x.sort() N = int(input()) if N == 1: print(1) else: print(x[N - 2])