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 java.util.function.*;
import java.util.concurrent.atomic.*;
import java.lang.reflect.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}
}

class Task {

	List<List<Integer>> list;
	List<Integer> aux, primes;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int n=in.readInt();
		list=new ArrayList<>();
		aux=new ArrayList<>();
		primes=new ArrayList<>();
		for (int i=2; i<=1000; i++) {
			boolean is=true;
			for (int j=2; j<i; j++) if (i%j==0) is=false;
			if (is) primes.add(i);
		}
		gen(n, n);
		BigInteger ans=BigInteger.valueOf(Long.MAX_VALUE);
		for (List<Integer> i: list) {
//			out.printLine(i);
			BigInteger val=BigInteger.ONE;
			for (int j=0; j<i.size(); j++) val=val.multiply(BigInteger.valueOf(primes.get(j)).pow(i.get(j)-1));
//			out.printLine(val);
			if (ans.compareTo(val)>0) ans=val;
		}
		out.printLine(ans);
	}
	
	void gen(int n, int p) {
		if (n==1) {
			list.add(new ArrayList<Integer>(aux));
			return;
		}
		for (int i=2; i<=p && i<=n; i++) if (n%i==0) {
			aux.add(i);
			gen(n/i, i);
			aux.remove(aux.size()-1);
		}
	}
}

// Heavy-light decomposition with path queries. Query complexity is O(log^2(n)).
// Based on the code from http://codeforces.com/blog/entry/22072
class HeavyLight {

	int getNeutralValue() {
		return Integer.MIN_VALUE;
	}

	final List<Integer>[] tree;
	final boolean valuesOnVertices; // true - values on vertices, false - values
									// on edges
	final SegmentTree segmentTree;
	final int[] parent;
	final int[] heavy;
	final int[] depth;
	final int[] pathRoot;
	final int[] pos;

	public HeavyLight(List<Integer>[] tree, boolean valuesOnVertices) {
		this.tree = tree;
		this.valuesOnVertices = valuesOnVertices;
		int n = tree.length;
		segmentTree = new SegmentTree(n);

		parent = new int[n];
		heavy = new int[n];
		depth = new int[n];
		pathRoot = new int[n];
		pos = new int[n];

		Arrays.fill(heavy, -1);
		parent[0] = -1;
		depth[0] = 0;
		dfs(0);
		for (int u = 0, p = 0; u < n; u++) {
			if (parent[u] == -1 || heavy[parent[u]] != u) {
				for (int v = u; v != -1; v = heavy[v]) {
					pathRoot[v] = u;
					pos[v] = p++;
				}
			}
		}
	}

	int dfs(int u) {
		int size = 1;
		int maxSubtree = 0;
		for (int v : tree[u]) {
			if (v != parent[u]) {
				parent[v] = u;
				depth[v] = depth[u] + 1;
				int subtree = dfs(v);
				if (maxSubtree < subtree) {
					maxSubtree = subtree;
					heavy[u] = v;
				}
				size += subtree;
			}
		}
		return size;
	}

	public int query(int u, int v) {
		final AtomicInteger res = new AtomicInteger(getNeutralValue()); // just
		// mutable
		// integer
		processPath(u, v, new BiConsumer<Integer, Integer>() {
			// (a, b) -> res.set(segmentTree.queryOperation(res.get(),
			// segmentTree.query(a, b))));
			@Override
			public void accept(Integer a, Integer b) {
				res.set(segmentTree.queryOperation(res.get(),
						segmentTree.query(a, b)));
			}
		});
		return res.get();
	}

	public void modify(int u, int v, final int delta) {
		processPath(u, v, new BiConsumer<Integer, Integer>() {
			@Override
			public void accept(Integer a, Integer b) {
				segmentTree.modify(a, b, delta);
			}
		});
	}

	void processPath(int u, int v, BiConsumer<Integer, Integer> op) {
		for (; pathRoot[u] != pathRoot[v]; v = parent[pathRoot[v]]) {
			if (depth[pathRoot[u]] > depth[pathRoot[v]]) {
				int t = u;
				u = v;
				v = t;
			}
			op.accept(pos[pathRoot[v]], pos[v]);
		}
		if (!valuesOnVertices && u == v)
			return;
		op.accept(Math.min(pos[u], pos[v]) + (valuesOnVertices ? 0 : 1),
				Math.max(pos[u], pos[v]));
	}

	static class SegmentTree {
		// Modify the following 5 methods to implement your custom operations on
		// the tree.
		// This example implements Add/Sum operations. Operations like Add/Max,
		// Set/Max can also be implemented.
		int modifyOperation(int x, int y) {
			return y;
		}

		// query (or combine) operation
		int queryOperation(int leftValue, int rightValue) {
			return Math.max(leftValue, rightValue);
		}

		int deltaEffectOnSegment(int delta, int segmentLength) {
			if (delta == getNeutralDelta())
				return getNeutralDelta();
			// Here you must write a fast equivalent of following slow code:
			// int result = delta;
			// for (int i = 1; i < segmentLength; i++) result =
			// queryOperation(result, delta);
			// return result;
			return delta;
		}

		int getNeutralDelta() {
			return Integer.MIN_VALUE;
		}

		int getInitValue() {
			return Integer.MIN_VALUE;
		}

		// generic code
		int[] value;
		int[] delta; // delta[i] affects value[i], delta[2*i+1] and delta[2*i+2]

		int joinValueWithDelta(int value, int delta) {
			if (delta == getNeutralDelta())
				return value;
			return modifyOperation(value, delta);
		}

		int joinDeltas(int delta1, int delta2) {
			if (delta1 == getNeutralDelta())
				return delta2;
			if (delta2 == getNeutralDelta())
				return delta1;
			return modifyOperation(delta1, delta2);
		}

		void pushDelta(int i) {
			int d = 0;
			for (; (i >> d) > 0; d++) {
			}
			for (d -= 2; d >= 0; d--) {
				int x = i >> d;
				value[x >> 1] = joinNodeValueWithDelta(x >> 1, 1 << (d + 1));
				delta[x] = joinDeltas(delta[x], delta[x >> 1]);
				delta[x ^ 1] = joinDeltas(delta[x ^ 1], delta[x >> 1]);
				delta[x >> 1] = getNeutralDelta();
			}
		}

		public SegmentTree(int n) {
			value = new int[2 * n];
			for (int i = 0; i < n; i++) {
				value[i + n] = getInitValue();
			}
			for (int i = 2 * n - 1; i > 1; i -= 2) {
				value[i >> 1] = queryOperation(value[i], value[i ^ 1]);
			}
			delta = new int[2 * n];
			Arrays.fill(delta, getNeutralDelta());
		}

		int joinNodeValueWithDelta(int i, int len) {
			return joinValueWithDelta(value[i],
					deltaEffectOnSegment(delta[i], len));
		}

		public int query(int from, int to) {
			from += value.length >> 1;
			to += value.length >> 1;
			pushDelta(from);
			pushDelta(to);
			int res = 0;
			boolean found = false;
			for (int len = 1; from <= to; from = (from + 1) >> 1, to = (to - 1) >> 1, len <<= 1) {
				if ((from & 1) != 0) {
					res = found ? queryOperation(res,
							joinNodeValueWithDelta(from, len))
							: joinNodeValueWithDelta(from, len);
					found = true;
				}
				if ((to & 1) == 0) {
					res = found ? queryOperation(res,
							joinNodeValueWithDelta(to, len))
							: joinNodeValueWithDelta(to, len);
					found = true;
				}
			}
			if (!found)
				throw new RuntimeException();
			return res;
		}

		public void modify(int from, int to, int delta) {
			from += value.length >> 1;
			to += value.length >> 1;
			pushDelta(from);
			pushDelta(to);
			int a = from;
			int b = to;
			for (; from <= to; from = (from + 1) >> 1, to = (to - 1) >> 1) {
				if ((from & 1) != 0) {
					this.delta[from] = joinDeltas(this.delta[from], delta);
				}
				if ((to & 1) == 0) {
					this.delta[to] = joinDeltas(this.delta[to], delta);
				}
			}
			for (int i = a, len = 1; i > 1; i >>= 1, len <<= 1) {
				value[i >> 1] = queryOperation(joinNodeValueWithDelta(i, len),
						joinNodeValueWithDelta(i ^ 1, len));
			}
			for (int i = b, len = 1; i > 1; i >>= 1, len <<= 1) {
				value[i >> 1] = queryOperation(joinNodeValueWithDelta(i, len),
						joinNodeValueWithDelta(i ^ 1, len));
			}
		}
	}

	// Random test
	public static void main(String[] args) {
		Random rnd = new Random(1);
		for (int step = 0; step < 1000; step++) {
			int n = rnd.nextInt(50) + 1;
			List<Integer>[] tree = getRandomTree(n, rnd);
			HeavyLight hl = new HeavyLight(tree, true);
			int[] x = new int[n];
			Arrays.fill(x, hl.segmentTree.getInitValue());
			for (int i = 0; i < 1000; i++) {
				int a = rnd.nextInt(n);
				int b = rnd.nextInt(n);
				List<Integer> path = new ArrayList<>();
				getPathFromAtoB(tree, a, b, -1, path);
				if (rnd.nextBoolean()) {
					int delta = rnd.nextInt(50) - 100;
					hl.modify(a, b, delta);
					for (int u : path)
						x[u] = hl.segmentTree.joinValueWithDelta(x[u], delta);
				} else {
					int res1 = hl.query(a, b);
					int res2 = hl.getNeutralValue();
					for (int u : path)
						res2 = hl.segmentTree.queryOperation(res2, x[u]);
					if (res1 != res2)
						throw new RuntimeException();
				}
			}
		}

		for (int step = 0; step < 1000; step++) {
			int n = rnd.nextInt(50) + 1;
			List<Integer>[] tree = getRandomTree(n, rnd);
			HeavyLight hl = new HeavyLight(tree, false);
			Map<Long, Integer> x = new HashMap<>();
			for (int u = 0; u < tree.length; u++)
				for (int v : tree[u])
					x.put(edge(u, v), hl.segmentTree.getInitValue());
			for (int i = 0; i < 1000; i++) {
				int a = rnd.nextInt(n);
				int b = rnd.nextInt(n);
				List<Integer> path = new ArrayList<>();
				getPathFromAtoB(tree, a, b, -1, path);
				if (rnd.nextBoolean()) {
					int delta = rnd.nextInt(50) - 100;
					hl.modify(a, b, delta);
					for (int j = 0; j + 1 < path.size(); j++) {
						long key = edge(path.get(j), path.get(j + 1));
						x.put(key, hl.segmentTree.joinValueWithDelta(
								x.get(key), delta));
					}
				} else {
					int res1 = hl.query(a, b);
					int res2 = hl.getNeutralValue();
					for (int j = 0; j + 1 < path.size(); j++) {
						long key = edge(path.get(j), path.get(j + 1));
						res2 = hl.segmentTree.queryOperation(res2, x.get(key));
					}
					if (res1 != res2)
						throw new RuntimeException();
				}
			}
		}
		System.out.println("Test passed");
	}

	static long edge(int u, int v) {
		return ((long) Math.min(u, v) << 16) + Math.max(u, v);
	}

	static boolean getPathFromAtoB(List<Integer>[] tree, int a, int b, int p,
			List<Integer> path) {
		path.add(a);
		if (a == b)
			return true;
		for (int u : tree[a])
			if (u != p && getPathFromAtoB(tree, u, b, a, path))
				return true;
		path.remove(path.size() - 1);
		return false;
	}

	static List<Integer>[] getRandomTree(int n, Random rnd) {
		List<Integer>[] t = new List[n];
		for (int i = 0; i < n; i++)
			t[i] = new ArrayList<>();
		int[] p = new int[n];
		for (int i = 0, j; i < n; j = rnd.nextInt(i + 1), p[i] = p[j], p[j] = i, i++)
			; // random permutation
		for (int i = 1; i < n; i++) {
			int parent = p[rnd.nextInt(i)];
			t[parent].add(p[i]);
			t[p[i]].add(parent);
		}
		return t;
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private String readLine0() {
		StringBuilder buf = new StringBuilder();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c == 'e' || c == 'E')
				return res * Math.pow(10, readInt());
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}

	public String next() {
		return readString();
	}

	public SpaceCharFilter getFilter() {
		return filter;
	}

	public void setFilter(SpaceCharFilter filter) {
		this.filter = filter;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}

	public int[] readIntArray(int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = readInt();
		return array;
	}

	public long[] readLongArray(int size) {
		long[] array = new long[size];
		for (int i = 0; i < size; i++)
			array[i] = readLong();
		return array;
	}

	public double[] readDoubleArray(int size) {
		double[] array = new double[size];
		for (int i = 0; i < size; i++)
			array[i] = readDouble();
		return array;
	}

	public String[] readStringArray(int size) {
		String[] array = new String[size];
		for (int i = 0; i < size; i++)
			array[i] = readString();
		return array;
	}

	public char[] readCharArray(int size) {
		char[] array = new char[size];
		for (int i = 0; i < size; i++)
			array[i] = readCharacter();
		return array;
	}

	public void readIntArrays(int[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = readInt();
		}
	}

	public void readLongArrays(long[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = readLong();
		}
	}

	public void readDoubleArrays(double[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = readDouble();
		}
	}

	public char[][] readTable(int rowCount, int columnCount) {
		char[][] table = new char[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readCharArray(columnCount);
		return table;
	}

	public int[][] readIntTable(int rowCount, int columnCount) {
		int[][] table = new int[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readIntArray(columnCount);
		return table;
	}

	public double[][] readDoubleTable(int rowCount, int columnCount) {
		double[][] table = new double[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readDoubleArray(columnCount);
		return table;
	}

	public long[][] readLongTable(int rowCount, int columnCount) {
		long[][] table = new long[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readLongArray(columnCount);
		return table;
	}

	public String[][] readStringTable(int rowCount, int columnCount) {
		String[][] table = new String[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readStringArray(columnCount);
		return table;
	}

	public String readText() {
		StringBuilder result = new StringBuilder();
		while (true) {
			int character = read();
			if (character == '\r')
				continue;
			if (character == -1)
				break;
			result.append((char) character);
		}
		return result.toString();
	}

	public void readStringArrays(String[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = readString();
		}
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(char[] array) {
		writer.print(array);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void print(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(array[i]);
		}
	}

	public void print(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(array[i]);
		}
	}

	public void printLine(int[] array) {
		print(array);
		writer.println();
	}

	public void printLine(long[] array) {
		print(array);
		writer.println();
	}

	public void printLine() {
		writer.println();
	}

	public void printLine(Object... objects) {
		print(objects);
		writer.println();
	}

	public void print(char i) {
		writer.print(i);
	}

	public void printLine(char i) {
		writer.println(i);
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

	public void printFormat(String format, Object... objects) {
		writer.printf(format, objects);
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}

	public void print(long i) {
		writer.print(i);
	}

	public void printLine(long i) {
		writer.println(i);
	}

	public void print(int i) {
		writer.print(i);
	}

	public void printLine(int i) {
		writer.println(i);
	}

	public void printTable(char[][] table) {
		for (char[] row : table)
			printLine(new String(row));
	}
}