Given the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.

Input

The first line of the input contains integer n (1 ≤ n ≤ 1000).

Output

Output the smallest positive integer with exactly n divisors.

Examples

Input

4


Output

6


Input

6


Output

12
import java.util.*; 
import java.io.*;
import java.math.BigInteger;

public class Main implements Runnable
{
   long inf = 2000000000000000000l;
   long[][] dp;
   ArrayList<Integer> primes;
   
   long go(int n, int k) {
      if (n == 1) return 1;
      if (dp[n][k] != 0) return dp[n][k];
      long ret = inf;
      long p = primes.get(k);
      c1: for (int i = 2; i <= n; i++) if (n%i == 0) {
         long suffix = go(n/i, k+1);
         long prefix = 1;
         for (int j = 0; j < i-1; j++)
            if (prefix > inf/p) break c1;
            else prefix *= p;
         if (prefix > inf/suffix) continue;
         ret = Math.min(ret, prefix*suffix);
      }
      return dp[n][k] = ret;
   }
   
   ArrayList<Integer> getPrimes(int cnt) {
      ArrayList<Integer> ret = new ArrayList<Integer>();
      final int m = 100000; 
      boolean[] p = new boolean[m+1];
      Arrays.fill(p, true);
      p[0] = p[1] = false;
      for (int i = 2; i*i <= m; i++) if (p[i]) {
         for (int j = i*i; j <= m; j+=i)
            p[j] = false;
         ret.add(i);
         if (ret.size() == cnt)
            break;
      }
      return ret;
   }
   
   void solution() throws Exception
   {
      int n = nextInt();
      dp = new long[n+1][n+1];
      primes = getPrimes(1000);
      long ret = go(n, 0);
      out.println(ret);
   }
   
   ///////////////////// Template definitions //////////////////////////
   int nextInt() throws IOException { return Integer.parseInt(next()); }
   long nextLong() throws IOException { return Long.parseLong(next()); }
   double nextDouble() throws IOException { return Double.parseDouble(next()); }
   
   String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
         String l = in.readLine();
         if (l == null) return null;
         st = new StringTokenizer(l);
      }
      return st.nextToken();
   }
   
   public static void main(String args[]) {
      Locale.setDefault(Locale.UK);
      new Thread(new Main()).start();
   }
   
   public void run() {
      try {
         boolean online = System.getProperty("ONLINE_JUDGE") != null;
         Reader reader = online
            ? new InputStreamReader(System.in)
            : new FileReader("my.in");
         in = new BufferedReader(reader);
         out = new PrintWriter(System.out);
         solution();
         out.flush();
         out.close();
      }
      catch (Exception e) {
         e.printStackTrace();
         System.exit(202);
      }
   }
   
   BufferedReader in;
   StringTokenizer st;
   PrintWriter out;
}