import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n == 1) { System.out.println(1); return; } ArrayList primes = new ArrayList<>(); for (int i = 100001; primes.size() < n; i++) { if (isPrime(i)) { primes.add(i); } } TreeSet set = new TreeSet<>(); for (int x : primes) { for (int y : primes) { set.add((long)x * y); } } for (long x : set) { n--; if (n == 1) { System.out.println(x); return; } } } static boolean isPrime(int x) { for (int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { return false; } } return true; } }