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
/*
Keep solving problems.
*/

import java.util.*;
import java.io.*;

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    private static final long MOD = 1000 * 1000 * 1000 + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};
    private static final String yes = "Yes";
    private static final String no = "No";

    List<Integer> fact;
    long res = Long.MAX_VALUE;
    int[] prime;
    void solve() throws IOException {
        int n = nextInt();

        prime = new int[]{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};
        List<Integer> ls = new ArrayList<>();
        fact = new ArrayList<>();
        for (int i = 2; i <= n; i++) {
            if (n % i == 0) {
                fact.add(i);
            }
        }

        dfs(n, ls, 0);

        outln(res);

    }

    void dfs(int mul, List<Integer> ls, int cur) {
        ls.add(mul);
        checkRes(ls);
        ls.remove(ls.size() - 1);

        if (mul == 1) {
            return;
        }

        if (mul % fact.get(cur) != 0) {
            dfs(mul, ls, cur + 1);
        }
        else {
            ls.add(fact.get(cur));
            dfs(mul / fact.get(cur), ls, cur);
            ls.remove(ls.size() - 1);
        }
    }

    void checkRes(List<Integer> ls) {
        List<Integer> pow = new ArrayList<>(ls);
        for (int v : pow) {
            if (v > 64) {
                return;
            }
        }

        long cand = 1L;
        Collections.sort(pow);
        Collections.reverse(pow);
        double pref = 1.0;
        for (int i = 0; i < pow.size(); i++) {
            int base = prime[i];
            for (int j = 0; j < pow.get(i) - 1; j++) {
                pref *= base;
                cand *= base;
                if (pref > MOD * MOD) {
                    return;
                }
            }
        }

        res = Math.min(res, cand);
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }

    long gcd(long a, long b) {
        while(a != 0 && b != 0) {
            long c = b;
            b = a % b;
            a = c;
        }
        return a + b;
    }

    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    private void formatPrint(double val) {
        System.out.format("%.9f%n", val);
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}