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.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Solution implements Runnable {
	private BufferedReader br;
	private StringTokenizer tok;
	private PrintWriter out;
	
	public static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	
	BigInteger binPow(long n, long p) {
		BigInteger res = BigInteger.ONE;
		BigInteger nn = BigInteger.valueOf(n);
		while (p > 0) 
			if (p % 2 == 1) {
				res = res.multiply(nn);
				p ^= 1;
			} else {
				nn = nn.multiply(nn);
				p >>= 1;
			}
		return res;
	}
	
	boolean isPrime(int x) {
		for (int i = 2; i * i <= x; ++i) 
			if (x % i == 0) 
				return false;
		return true;
	}
		
	void solve() throws IOException {
		int n = nextInt();
		if (n == 1) {
			out.print(1);
			out.close();
			return;
		}
		ArrayList<Integer> dc = new ArrayList<Integer>();
		for (int i = 2; i * i <= n; ++i) 
			while (n % i == 0) {
				dc.add(i);
				n /= i;
			}
		if (n > 1) {
			dc.add(n);
		}
		Collections.reverse(dc);
		int q = dc.size();
		ArrayList<Integer> primes = new ArrayList<Integer>();
		for (int i = 2; ; ++i) {
			if (isPrime(i)) {
				primes.add(i);
			}
			if (primes.size() == q) 
				break;
		}
	/*	for (int i = 0; i < dc.size(); ++i) {
			out.print(dc.get(i) + " ");
		}*/
	//	out.println();
		BigInteger[][] dp = new BigInteger[q][q];
		for (int i = 0; i < q; ++i)
			for (int j = 0; j <= i; ++j)
				if (j == 0) {
					long mu = 1;
					for (int k = 0; k <= i; ++k) {
						mu *= dc.get(k);
					}
					dp[i][j] = binPow(primes.get(0), mu - 1);
				} else {
					dp[i][j] = dp[i - 1][j - 1].multiply(binPow(primes.get(j), dc.get(i) - 1));
				/*	if (j <= i - 1 && dp[i][j].compareTo(dp[i - 1][j].multiply(binPow(primes.get(j), dc.get(i) - 1))) == 1) {
						dp[i][j] = dp[i - 1][j].multiply(binPow(primes.get(j), dc.get(i)));
					}*/
				}
/*		for (int i = 0; i < q; ++i) {
			for (int j = 0; j < q; ++j) {
				out.print(dp[i][j] + " ");
			}
			out.println();
		}*/
		BigInteger res = dp[q - 1][0];
		for (int j = 1; j < q; ++j) 
			if (dp[q - 1][j].compareTo(res) == -1) {
				res = dp[q - 1][j];
			}
		out.print(res);
	}
		
	public void run() {
		try {
			if (ONLINE_JUDGE) {
				br = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				br = new BufferedReader(new FileReader(new File("input.txt")));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();
			br.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	public static void main(String[] args) {
		new Solution().run();
	}	
	
	String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens())
			tok = new StringTokenizer(br.readLine());
		return tok.nextToken();
	}
	
	String nextString() throws IOException {
		return nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	
	BigInteger nextBigInteger() throws IOException {
		return new BigInteger(nextToken());
	}
}