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
//package com.cf.r27;//package com.cf.r664;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.OptionalInt;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class E {

	private FastScanner in;
	private PrintWriter out;
	private Set<Integer> primes;

	public static void main(String[] args) {
		new E().run();
	}

	private void run() {
		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		int n = in.nextInt();

		this.primes = IntStream.range(2, 1000).filter(this::isPrime).boxed().collect(Collectors.toSet());

		out.println(solve(n, 1));

		out.close();
	}

	private boolean isPrime(int n) {
		for (int i = 2; i * i <= n; i++) {
			if (n % i == 0) return false;
		}
		return true;
	}

	private long solve(int n, int from) {
		if (n == 1) return 1;

		long p = nextPrime(from);
		long best = Long.MAX_VALUE;
		for (int i = 2; i <= n; i++) if (n % i == 0) {
			long prod = expo(p, i - 1);
			if (prod == Long.MAX_VALUE) continue;

			long option = solve(n / i, (int) p);
			if (option == Long.MAX_VALUE || option > 1e18 / prod) continue;

			best = Math.min(best, option * prod);
		}

		return best;
	}

	private long expo(long p, int i) {
		long res = 1;
		long cur = p;
		while (i > 0) {
			if (i % 2 == 1) {
				if (res == Long.MAX_VALUE || res * 1.0 * cur > 1e18) res = Long.MAX_VALUE;
				else res *= cur;
			}

			i /= 2;
			cur = (cur > 1e9? Long.MAX_VALUE : cur * cur);
		}
		return res;
	}

	private int nextPrime(int from) {
		for (int i = from + 1; i < 1000; i++) {
			if (this.primes.contains(i)) return i;
		}
		throw new RuntimeException("lala");
	}

	static class FastScanner {

		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}
