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.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
public class Main
{
    Scanner cin;
    int N;
    int p[]={2,3,5,7,11,13,17,19,23,29};
    void work()
    {
        cin=new Scanner(System.in); 
        N=cin.nextInt();
        long []v=new long[11];
        int top=0;
        int m=N;
        for(int i=2;i*i<=m;i++)
        {
        	while(N%i==0)
        	{
        		N/=i;v[top++]=i;
        	}
        }
        if(N!=1) v[top++]=N;
        long []t=new long[top];
        for(int i=0;i<top;i++) t[i]=v[top-1-i];
        long ret=jisuan(t);
        System.out.println(ret);
    }
    long jisuan(long []v)
    {
    	BigInteger best=BigInteger.ONE;
    	for(int i=0;i<v.length;i++)
    	{
    		for(int j=0;j<v[i]-1;j++)
    		{
    			best=best.multiply(BigInteger.valueOf(p[i]));
    		}
    	}
    	long []bv=v.clone();
    	while(true)
    	{
    		if(v.length<=1)break;
    		BigInteger tmp=improve(v,bv);
    		if(tmp.compareTo(best)<0){best=tmp;v=bv;}
    		else return best.longValue();
    	}
    	return best.longValue();
    }
    BigInteger improve(long []t,long []bv)
    {
    	long[]v=new long[t.length-1];
    	for(int i=0;i<v.length;i++) v[i]=t[i];
    	BigInteger ret=BigInteger.valueOf(Long.MAX_VALUE);
    	for(int i=0;i<v.length;i++)
    	{
    		BigInteger tmp=getv(v,i,t[t.length-1]);
    		if(tmp.compareTo(ret)<0) 
    		{
    			ret=tmp;
    			bv=v.clone();
    			v[i]+=t[t.length-1];
    		}
    	}
    	return ret;
    }
    BigInteger getv(long []v,int idx,long t)
    {
    	v[idx]*=t;
    	BigInteger best=BigInteger.ONE;
    	for(int i=0;i<v.length;i++)
    	{
    		for(int j=0;j<v[i]-1;j++)
    		{
    			best=best.multiply(BigInteger.valueOf(p[i]));
    			if(best.compareTo(BigInteger.valueOf(Long.MAX_VALUE))>0)return best;
    		}
    	}
    	v[idx]/=t;
    	return best;
    }
  public static void main(String args[]) throws Exception 
  { 
   new Main().work();
  } 
}  