def Eratosthenes(N): #N以下の素数のリストを返す #iが素数のときis_prime_list[i]=1,それ以外は0 N+=1 is_prime_list = [True]*N # is_prime_list[0], is_prime_list[1] = False, False #リストが必要なときはこの2行を有効化 # for j in range(4,N,2): is_prime_list[j] = False m = int(N**0.5)+1 for i in range(3,m,2): if is_prime_list[i]: is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1) return [2] + [i for i in range(3,N,2) if is_prime_list[i]] # return is_prime_list # coding: utf-8 # Your code here! import sys readline = sys.stdin.readline read = sys.stdin.read #a,b = [int(i) for i in readline().split()] n = int(input()) V = 10**5 p = Eratosthenes(V+10**3) x = [i for i in p if i >= V] res = set([i*j for i in x for j in x] + [1]) print(sorted(res)[n-1])