n = int(input()) import math def sieve(n): ass = [] is_prime = [True]*(n+1) is_prime[0] = False is_prime[1] = False for i in range(2, int(math.sqrt(n))+1): if not is_prime[i]: continue for j in range(i*2, n+1, i): is_prime[j] = False for i in range(n+1): if is_prime[i]: ass.append(i) return(ass) S = sieve(10**5) T = sieve(2*10**5) #print(len(S)) #print(len(T)) P = T[len(S):len(S)+10] #print(P) ans = [1] for i in range(10): for j in range(10): ans.append(P[i]*P[j]) ans = list(set(ans)) ans.sort() print(ans[n-1])