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.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    int cnt(int a) {
        int cnt = 0;
        for (int i = 1; i <= a; ++i)
            if (a % i == 0)
                ++cnt;
        return cnt;
    }

    int[] stack = new int[1000];
    int sz = 0;
    ArrayList<Integer> lst = new ArrayList<Integer>();

    int[] primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,
            53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
            127, 131, 137, 139, 149, };

    BigInteger res = new BigInteger(
            "9999999999999999999999999999999999999999999999999999999999");

    void rec(int n) {
        if (n == 1) {
            lst.clear();
            for (int i = 0; i < sz; ++i)
                lst.add(stack[i]);
            Collections.sort(lst);
            BigInteger a = BigInteger.ONE;
            int cur = 0;
            for (int i = lst.size() - 1; i >= 0; --i) {
                int qwe = lst.get(i) - 1;
                a = a.multiply(BigInteger.valueOf(primes[cur++]).pow(qwe));
            }
            if (a.compareTo(res) < 0)
                res = a;
        } else {
            for (int i = 2; i <= n; ++i)
                if (n % i == 0) {
                    stack[sz++] = i;
                    rec(n / i);
                    --sz;
                }
        }
    }

    void solve() throws IOException {
        /*
         * int[] ret = new int[1000]; Arrays.fill(ret, -1);
         * 
         * for (int i = 1; i <= 10000; ++i) { int a = cnt(i); if (ret[a] == -1)
         * ret[a] = i; } for (int i = 1; i <= 100; ++i) { System.err.println(i +
         * ": " + ret[i]); }
         */
        int n = ni();
        rec(n);
        out.println(res);
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }
}
