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.util.*;


public class test {
    int INF = (int)1e9;
    long MOD = 1000000007;
    
    long pow(long a, long n) {
        if (n == 0) {
            return 1;
        }
        long rs = 1;
        while (n > 0) {
            if (n % 2 == 1) {
                rs *= a;
            }
            n >>= 1;
            a *= a;
        }
        return rs;
    }
    
    long min(long...a) {
        long rs = a[0];
        for(long x: a) rs = Math.min(rs, x);
        return rs;
    }
    
    void solve(InputReader in, PrintWriter out) throws IOException {
        int l = 1010;
        int[] p = new int[l];
        p[0] = p[1] = 1;
        int[] primes = new int[l];
        int q = 0;
        for(int i=2; i<l; i++) if(p[i]==0) {
            p[i] = i;
            primes[q++] = i;
            for(int j=i*i; j<l; j+=i) {
                p[j] = i;
            }
        }
        primes = Arrays.copyOf(primes, 10);
        int n = in.nextInt();
        if(n==1) {
            out.println(1);
            return;
        }
        int[] f = new int[100];
        q = 0;
        int x = n;
        while(x>1) {
            f[q++] = -p[x];
            x /= p[x];
        }
        if(x>1) {
            f[q++] = -x;
        }
        f = Arrays.copyOf(f, q);
        Arrays.sort(f);
        //show(f);
        long[][] dp = new long[primes.length][f.length];
        long[] s = new long[f.length];
        s[0] = -f[0];
        for(int i=1; i<f.length; i++) {
            s[i] = -f[i]*s[i-1];
        }
        //show("s", s);
        for(int j=0; j<f.length; j++) {
            dp[0][j] = pow(primes[0], s[j]-1);
            if(dp[0][j]<=0) dp[0][j] = Long.MAX_VALUE;
        }
        for(int i=1; i<primes.length; i++) {
            dp[i][0] = dp[0][0];
        }
        for(int i=1; i<primes.length; i++) {
            for(int j=1; j<f.length; j++) {
                dp[i][j] = min(dp[i-1][j-1] * pow(primes[i], -f[j]-1), dp[i-1][j]);
                if(dp[i][j]<=0) dp[i][j] = dp[i-1][j];
                for(int k=1; k<=j; k++) {
                    long v = dp[i-1][k-1] * pow(primes[i], s[j]/s[k-1]-1);
                    if(v<=0) continue;
                    dp[i][j] = min(v, dp[i][j]);
                }
            }
        }
        //show("kick");
        //for(long[] xi: dp) show(xi);
        out.println(dp[primes.length-1][f.length-1]);
    }
    
    
    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-->0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
    
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}