import sys readline = sys.stdin.readline ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(map(int, readline().split())) def solve(): n = ni() m = 10**5 + 10**2 s = [1]*m for i in range(3, m, 2): if s[i]: for j in range(i*i, m, i): s[j] = 0 g = [i for i in range(100001, m, 2) if s[i]] f = sorted(set([x*y for x in g for y in g] + [1])) print(f[n-1]) return solve()