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.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class E {

    public long[][] dp;
    public boolean[] p;
    public ArrayList<Integer> list;
    

    void solve() {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();

        p = new boolean[1000000];
        p[0] = true;
        p[1] = true;
        list = new ArrayList();
        for (int i = 2; i < p.length; i++) {
            if (!p[i]) {
                list.add(i);
                for (int j = i * i; j < p.length; j += i) {
                    if (j < 0) {
                        break;
                    }
                    p[j] = true;
                }
            }
        }
        //    System.out.println(list.size());
//        dp = new long[n + 1];
//        dp[1] = 1;
//        for(int i = 2; i < dp.length; i++){
//            for(int j = 2; j <= i/2)
//        }
        if (n == 1) {
            out.println(1);
        } else {
            dp = new long[1000][n + 1];
            for (long[] temp : dp) {
                Arrays.fill(temp, -1);
            }
            out.println(cal(0, n));
        }

        out.close();
    }

    public long cal(int index, int val) {
        //    System.out.println("Start " + index + " " + val);
        if (!p[val]) {
            return pow(list.get(index), val - 1);
        }
        if (dp[index][val] != -1) {
            return dp[index][val];
        }
        long result = Long.MAX_VALUE;
        for (int i = 2; i * i <= val; i++) {
            if (val % i == 0) {
                int other = val / i;
                long a = cal(index + 1, other);
                if (a != Long.MAX_VALUE) //     System.out.println(a + " " + i + " " + other);
                {
                    a *= pow(list.get(index), i - 1);
                }
          //       System.out.println(a + " " + i + " " + other);
                long b = cal(index + 1, i);


                if (b != Long.MAX_VALUE) //     System.out.println(a + " " + i + " " + other);
                {
                    b *= pow(list.get(index), other - 1);
                }
                if(a > 0){
                    result = Math.min(a , result);
                }
                if(b > 0){
                    result = Math.min(b, result);
                }
                
            }
        }
        return dp[index][val] = result;
    }

    public long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return val * val;
        } else {
            return a * val * val;
        }
    }

    public static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y, a.z - b.z);
    }

    public static void rate(Point a, double rate) {
        a.x = a.x * rate;
        a.y = a.y * rate;
        a.z = a.z * rate;
    }

    public static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y, a.z + b.z);
    }

    public static double distance(Point a, Point b) {
        double total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z);
        return Math.sqrt(total);
    }

    public long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static class Point {

        double x, y, z;

        public Point(double x, double y, double z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        public String toString() {
            return x + " " + y + " " + z;
        }
    }

    public static class Edge {

        int num, weight;

        public Edge(int num, int weight) {
            this.num = num;
            this.weight = weight;
        }
    }

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

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {


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

        public long nextLong() {
            return Long.parseLong(next());
        }

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}