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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.math.BigInteger;
import static java.util.Arrays.*;

public class Main implements Runnable {
    
    
    BigInteger Minimal = new BigInteger("100000000000000000000000000000000000000000000000");
    //final long MAXIMAL = (long)1000*1000*1000*1000*1000*999+1;
    boolean find = false;
    int[] primes,a;
    ArrayList<Integer> all = new ArrayList<Integer>();
    int N;

    void solve(){
        
        int n = nextInt();
        
        if (n==1)
        {
            out.println(1);
            return;
        }
        primes = new int[1001];
        primes[0]=2;
        int length=1,cur=3;
        boolean isp;
        while (primes[length-1]<1000)
        {
            isp=true;
            for (int i=0; primes[i]*primes[i]<=cur; i++)
            {
                if (cur%primes[i]==0)
                {
                    isp=false;
                    break;
                }
            }
            if (isp)
                primes[length++]=cur;
            cur+=2;
        }
        int tmp = n, index = 0;
        ArrayList<Integer> allDiv = new ArrayList<Integer>();
        while (tmp>1)
        {
            if (tmp%primes[index]==0)
            {
                while (tmp%primes[index]==0)
                {
                    allDiv.add(primes[index]);
                    tmp/=primes[index];
                }
            }
            index++;
        }

        long result = 1;
        
        int nm = allDiv.size();
        N = nm;
        a = new int[N];
        for (int i=0; i<allDiv.size(); i++)
        {
            a[i]=allDiv.get((nm-1)-i);
        }
              
        rec(0,1);
        out.println(Minimal);
      }
    
    void rec(int index, int domn)
    {
        if (index<N-1) rec(index+1, domn*a[index]);
        if (index<N)
        {
            int number = (domn*a[index])-1;
            all.add(number);
            rec(index+1,1);
            all.remove(all.size()-1);
        }
        else
        {
            int[] temp = new int[all.size()];
            for (int i=0; i<all.size(); i++)
            {
                temp[i]=all.get(i);
            }
            Arrays.sort(temp);
                     
            BigInteger tempRes = BigInteger.ONE;
            for (int i=0; i<temp.length; i++)
            {
                for (int j=0; j<temp[i]; j++)
                {
                    tempRes = tempRes.multiply(BigInteger.valueOf(primes[temp.length-1-i]));
                }
            }
            if (tempRes.compareTo(Minimal)<0)
            {
                Minimal=tempRes;
                find = true;
            }
        }
    }
    

    StringTokenizer st;
    PrintWriter out;
    BufferedReader br;
    boolean eof = false, in_out = false, std = false;

    public static void main(String[] args) {
        new Thread(new Main()).start();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "$";
            }
        }
        return st.nextToken();
    }

    String nextLine() {
        String ret = "";
        try {
            ret = br.readLine();
        } catch (Exception e) {
            ret = "";
        }
        if (ret == null) {
            eof = true;
            return "$";
        }
        return ret;
    }

    String nextS() {
        return nextToken();
    }

    int nextInt() {
        return Integer.parseInt(nextToken());
    }

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    void swap(int[] arr, int index1, int index2){
        int tmp=arr[index1];
        arr[index1]=arr[index2];
        arr[index2]=tmp;
    }

    public void run() {
        long time = System.currentTimeMillis();
        try {
            //br = new BufferedReader(new FileReader(new File("input.txt")));
            //out = new PrintWriter(new File("output.txt"));
            //br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"), "ISO-8859-1"));
            //out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("output.txt"), "ISO-8859-1"));
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            solve();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(111);
        }
        //System.err.println(System.currentTimeMillis() - time);
        out.close();
    }
}