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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        NumberWithTheGivenAmountOfDivisors solver = new NumberWithTheGivenAmountOfDivisors();
        solver.solve(1, in, out);
        out.close();
    }

    static class NumberWithTheGivenAmountOfDivisors {
        ArrayList<Integer> primes;
        long[][] memo;

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int n = sc.nextInt();
            boolean[] isPrime = new boolean[2000];
            Arrays.fill(isPrime, true);
            isPrime[0] = isPrime[1] = false;
            for (int i = 2; i * i <= 2000; i++)
                if (isPrime[i])
                    for (int j = i * i; j < 2000; j += i)
                        isPrime[j] = false;
            primes = new ArrayList<>();
            for (int i = 2; i < 2000; i++)
                if (isPrime[i])
                    primes.add(i);
            memo = new long[11][n + 1];
            for (long[] x : memo)
                Arrays.fill(x, -1);
            pw.println(dp(0, n));
        }

        private long dp(int idx, int rem) {
            if (idx > 10)
                return Long.MAX_VALUE;
            if (rem == 1) {
                return 1;
            }
            if (memo[idx][rem] != -1)
                return memo[idx][rem];
            long leave = dp(idx + 1, rem);
            long take = Long.MAX_VALUE;
            long cur = 1;
            for (int i = 1; i <= rem; i++) {
                try {
                    cur = Math.multiplyExact(cur, primes.get(idx));
                } catch (Exception e) {
                    break;
                }
                if (rem % (i + 1) != 0)
                    continue;
                long temp = dp(idx + 1, rem / (i + 1));
                try {
                    take = Math.min(take, Math.multiplyExact(temp, cur));
                } catch (Exception e) {
                    continue;
                }
            }
            return memo[idx][rem] = Math.min(take, leave);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

