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.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;


public class E_NumberWithTheGivenAmountOfDivisors {

    /**
     * @param args
     */
    
    static int[] primes;
    static int P = 1000;
    public static void main(String[] args) {

        
        System.out.println(go());
        
    }
    
    private static long go(){
        primes = generatePrimes(P);
        
        
        
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        
        int[] cofs = decompose(n);
        List<Integer> tmp = new ArrayList<Integer>();
        for (int i = 0; i < cofs.length; i++) {
            for (int j = 0; j < cofs[i]; j++) {
                tmp.add(primes[i]);
            }
        }

        Integer[] decs = tmp.toArray(new Integer[]{});
        
        long min = Long.MAX_VALUE;
        
        Queue<Integer[]> q = new LinkedList<Integer[]>();
        q.offer(decs);
        while(! q.isEmpty()){
            Integer[] cur = q.poll();
            
            long r = calc(cur).longValue();
            if(r < min) min = r;
            
            //if(true)break;
            List<Integer[]> nexts = reduce(cur);
            for (Integer[] next : nexts) q.offer(next);
            
        }
        
//      if(min == Long.MAX_VALUE) min = -1;
        
        return min;
    }
    
    private static BigInteger calc(Integer[] decs){
        BigInteger r = BigInteger.ONE;
        int D = decs.length;
        for (int i = 0; i < D; i++) {
            BigInteger bi = pow(primes[D-1-i], decs[i]-1);
            r = r.multiply(bi);
            if(r.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) return BigInteger.valueOf(Long.MAX_VALUE);
        }
        return r;
    }
    
    private static List<Integer[]> reduce(Integer[] src){
        List<Integer[]> ret = new ArrayList<Integer[]>();
        int L = src.length;
        for (int i = 0; i < L-1; i++) {
            for (int j = i+1; j < L; j++) {
                List<Integer> tmp = new ArrayList<Integer>();
                tmp.add(src[i]*src[j]);
                for (int k = 0; k < L; k++) {
                    if(k != i && k != j){
                        tmp.add(src[k]);
                    }
                }
                Collections.sort(tmp);
                ret.add(tmp.toArray(new Integer[]{}));
                
            }
        }
        
        
        return ret;
    }
    
    private static BigInteger pow(long l, int n){
        if(n == 0) return BigInteger.ONE;
        if(n%2==0){
            BigInteger tmp = pow(l, n/2);
            return tmp.multiply(tmp);
        }else{
            BigInteger tmp = pow(l, n/2);
            return tmp.multiply(tmp).multiply(BigInteger.valueOf(l));
        }
    }
    
    private static int[] decompose(int a){
        int[] ret = new int[P];
        int pi = 0;
        while(a>1){
            while(a%primes[pi]==0){
                ret[pi]++;
                a /= primes[pi];
            }
            pi++;
        }
        return ret;
    }
    
    
    private static int[] generatePrimes(int cnt){
        
        int[] ret = new int[cnt];
        int a = 0;
        int cur = 2;
        while(a < cnt){
            boolean flg = true;
            for (int i = 0; i < a; i++) {
                if(cur%ret[i]==0){
                    flg = false;
                    break;
                }
            }
            
            if(flg){
                ret[a] = cur;
                a++;
            }
            cur++;
            
        }
        
        return ret;
    }

}
