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.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start(); 
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");
	
	long T18 = 1000000000000000000L;
	int MAXP = 47;
	boolean[] erat = new boolean [MAXP + 1];
	int pNum = 0;
	int[] primes = new int [15];
	int[] maxDeg;
	long[][] primePow;
	
	long answer = Long.MAX_VALUE;
	
	void run() throws IOException {
		for (int i = 2; i <= MAXP; i++) {
			if (!erat[i]) {
				primes[pNum++] = i;
				for (int j = i * i; j <= MAXP; j += i)
					erat[j] = true;
			}
		}
		maxDeg = new int [pNum];
		primePow = new long [pNum][70];
		for (int i = 0; i < pNum; i++) {
			long cp = primes[i];
			primePow[i][0] = 1L;
			for (maxDeg[i] = 1; !overflow(primePow[i][maxDeg[i] - 1], cp, T18); maxDeg[i]++)
				primePow[i][maxDeg[i]] = primePow[i][maxDeg[i] - 1] * cp;
		}
		
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		int n = nextInt();
		rec(n, 1L, 0, n);
		out.println(answer);
		
		out.close();
	}
	
	void rec(int rest, long have, int curPrime, int maxDivisor) {
//		System.out.println(rest + " " + have + " " + curPrime + " " + maxDivisor);
		if (rest == 1) {
			answer = min(answer, have);
		} else {
			for (int div = min(maxDivisor, maxDeg[curPrime] + 1); div > 1; div--) {
				if (rest % div == 0) {
					long curPow = primePow[curPrime][div - 1];
					if (!overflow(have, curPow, T18)) {
						rec(rest / div, have * curPow, curPrime + 1, div);
					}
				}
			}
		}
	}
	
	boolean overflow(long a, long b, long c) {
		return a > c / b;
	}

	/*************************************************************** 
	 * Utility
	 **************************************************************/
	long b2mb(long b) {
		return b >> 20;
	}
	
	void checkMemory() {
		System.err.println(b2mb(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + "/" + b2mb(Runtime.getRuntime().totalMemory()) + " MB");
	}
	
	/*************************************************************** 
	 * Input 
	 **************************************************************/
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.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());
	}
	
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}
