import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) def is_prime(p): if p == 1: return 0 for k in range(2, int(p**0.5) + 1): if p%k == 0: return 0 else: return 1 n = I() if n == 1: print(1) else: cnt = 0 m = 10**5+1 pr = [] while cnt <= 10: if is_prime(m) == 1: pr.append(m) cnt += 1 m += 1 else: m += 1 ans = [] for i in range(10): for j in range(i, 10): ans.append(pr[i]*pr[j]) print(ans[n-1])