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.io.*;

public class FindDiv {
	static long [][] dp = new long [1 << 11][1005];
	static ArrayList <Long> prime = new ArrayList <> ();
	static int n;
	final static long inf = (long) 1e18;

	static long func(int m, int num) {
		// System.out.println(m + " " + num);
		if(num == 1) {
			return 1;
		}
		if(m == (1 << 10) - 1) {
			return 0;
		}
		if(dp[m][num] != -1) return dp[m][num];

		long ans = Long.MAX_VALUE;
		for(int k = 0; k < 10; k++) {
			if(((m >> k) & 1) == 1) continue;

			int power = 1;
			for(long i = prime.get(k); ; i *= prime.get(k)) {
				++power;
				boolean bk = false;
				if((inf / i) < prime.get(k)) bk = true;
				if(power > num) break;
				if(num % power == 0) {
					//if(i == 0) {
					//	System.out.println (prime.get(k) + " " + power);
					//}
					// System.out.println (i + " " + power + " " + prime.get(k));

					long res = func(m | (1 << k), num / power);
					if((inf / i) >= res && res != 0) {
						ans = Math.min(ans, i * res);
					}
				} 
				if(bk) break;
			}
		}
		if(ans == Long.MAX_VALUE) ans = 0;
		return dp[m][num] = ans;
	}
	public static void main (String[] args) {
		Reader in = new Reader ();
		int n = in.nextInt();
		for(int i = 2; ; i++) {
			boolean yes = true;
			for(int j = 2; j < i; j++) {
				if((i % j) == 0) {
					yes = false;
					break;
				} 
			}
			if(yes) prime.add(new Long(i));
			if(prime.size() >= 10) break;
		}	
		for(int i = 0; i < (1 << 10); i++) {
			for(int j = 0; j <= 1000; j++) {
				dp[i][j] = -1;
			}
		}
		// System.out.println(prime);
		System.out.println(func(0, n));
	}	
	static class Reader {
		private BufferedReader a;
		private StringTokenizer b;
		Reader() {
			a = new BufferedReader (new InputStreamReader (System.in));
		} 
		public String next () {
			while(b == null || !b.hasMoreTokens()) {
				try {
					 b = new StringTokenizer (a.readLine());
				 } catch (IOException e) {
					 e.printStackTrace();
				 }
			 }
			 return b.nextToken();
		}
		public int nextInt () {
		     return Integer.parseInt(next());
		}
		public long nextLong () {
			return Long.parseLong(next());
		}
		public double nextDouble () {
			return Double.parseDouble(next());
		}
		public String nextLine () {
		 	try {
		 		return a.readLine();
		 	} catch (IOException e) {
		 		e.printStackTrace ();
		 	}
		 	return "##";
		}
	}
	static class Pair <P, Q> {
		P first;
		Q second;
		Pair () {}
		Pair (P first, Q second) {
			this.first = first;
			this.second = second;
		}
	}
}
