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); } } PriorityQueue queue = new PriorityQueue<>(); for (int x : primes) { for (int y : primes) { queue.add((long)x * y); } } for (int i = 0; i < n - 2; i++) { queue.poll(); } System.out.println(queue.poll()); } static boolean isPrime(int x) { for (int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { return false; } } return true; } }