import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log2 from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul, add from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from heapq import heappush, heappop from functools import reduce, lru_cache def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def ZIP(n): return zip(*(MAP() for _ in range(n))) sys.setrecursionlimit(10 ** 9) INF = float('inf') mod = 10 ** 9 + 7 def is_prime(num): """ 素数判定 """ from math import sqrt if num < 2: return False if num in [2, 3, 5]: return True if num % 2 == 0 or num % 3 == 0 or num % 5 == 0: return False # 疑似素数(2でも3でも割り切れない数字)で次々に割っていく prime = 7 step = 4 num_sqrt = sqrt(num) while prime <= num_sqrt: if num % prime == 0: return False prime += step step = 6 - step return True N = INT() ans = [1] prime = [] cnt = 0 n = 10**5+1 while cnt <= 10: if is_prime(n): cnt += 1 prime.append(n) n += 1 suteki = [] for i, j in combinations(prime, 2): suteki.append(i*j) for x in prime: suteki.append(x**2) suteki.sort() ans += suteki print(ans[N-1])