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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class E {

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

    private StringTokenizer st = new StringTokenizer("");
    private BufferedReader br;
    private LinkedList<Integer> stack = new LinkedList<Integer>();
    private int[] primes;
    private int[] divs;
    private long best;

    private void solve() throws IOException {
        this.br = new BufferedReader(new InputStreamReader(System.in));
        int n = nextInt();
        this.br.close();
        this.primes = genPrime(n);
//        System.out.println("primes " + Arrays.toString(primes));

        this.divs = getDividers(n);
        this.best = Long.MAX_VALUE;
        rec(this.divs.length - 1, n);

        PrintWriter pw = new PrintWriter(System.out);
        pw.println(this.best);
        pw.close();
    }

    private int[] getDividers(int n) {
        List<Integer> dividers = new ArrayList<Integer>();
        for (int i = 2; i <= n; i++) {
            if (n % i == 0) {
                dividers.add(i);
            }
        }
        return toArray(dividers);
    }

    private void rec(int prevDividerInd, int n) {
        if (n == 1) {
            update();
            return;
        }
        int k = prevDividerInd;
        while (n < this.divs[k]) {
            k--;
        }
        while (k >= 0) {
            int d = this.divs[k];
            if (n % d == 0) {
                this.stack.addLast(d);
                rec(k, n / d);
                this.stack.removeLast();
            }
            k--;
        }
    }

    private void update() {
//        System.out.println("Checking for " + this.stack);
        long local = 1;
        double localDouble = 1;
        int i = 0;
        for (Integer pow : stack) {
            local = local * pow(this.primes[i], pow - 1);
            localDouble = localDouble * powDouble(this.primes[i], pow - 1);
            i++;
        }
        if (Math.abs(1 - local / localDouble) < 1e-5) {
            this.best = Math.min(this.best, local);
        }
    }

    long pow(int a, int pow) {
        long res = 1;
        for (int i = 0; i < pow; i++) {
            res *= a;
        }
        return res;
    }

    double powDouble(int a, int pow) {
        double res = 1;
        for (int i = 0; i < pow; i++) {
            res *= a;
        }
        return res;
    }

    private int[] genPrime(int n) {
        boolean[] prime = new boolean[n + 1];
        Arrays.fill(prime, true);
        for (int i = 2; i <= n; i++) {
            if (prime[i]) {
                int j = 2 * i;
                while (j <= n) {
                    prime[j] = false;
                    j += i;
                }
            }
        }
        List<Integer> res = new ArrayList<Integer>();
        for (int i = 2; i <= n; i++) {
            if (prime[i]) {
                res.add(i);
            }
        }
        return toArray(res);
    }

    int[] toArray(List<Integer> list) {
        int[] a = new int[list.size()];
        for (int i = 0; i < list.size(); i++) {
            a[i] = list.get(i);
        }
        return a;
    }

    private int nextInt() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return Integer.parseInt(st.nextToken());
    }

}
