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.IOException;
import java.io.InputStreamReader;
import java.io.Closeable;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Jacob Jiang
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		QuickScanner in = new QuickScanner(inputStream);
		ExtendedPrintWriter out = new ExtendedPrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
    final long[] prime = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};

    public void solve(int testNumber, QuickScanner in, ExtendedPrintWriter out) {
        int n = in.nextInt();
        long[][] dp = new long[10][n + 1];
        for (int i = 0; i < 10; i++) {
            dp[i][1] = 1;
        }
        for (int j = 2; j <= Math.min(n, 61); j++) {
            dp[0][j] = 1l << (j - 1);
        }
        for (int i = 1; i < 10; i++) {
            for (int j = 2; j <= n; j++) {
                for (int k = 0; k < j; k++) {
                    if (j % (k + 1) == 0 && dp[i - 1][j / (k + 1)] != 0) {
                        if (dp[i][j] == 0) dp[i][j] = calc(dp[i - 1][j / (k + 1)], prime[i], k);
                        else dp[i][j] = Math.min(dp[i][j], calc(dp[i - 1][j / (k + 1)], prime[i], k));
                    }
                }
            }
        }
        long answer = Long.MAX_VALUE;
        for (int i = 0; i < 10; i++) {
            if (dp[i][n] != 0)
                answer = Math.min(answer, dp[i][n]);
        }
        out.println(answer);
    }

    long calc(long a, long p, int k) {
        BigInteger result = BigInteger.valueOf(a).multiply(BigInteger.valueOf(p).pow(k));
        if (result.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) >= 0) {
            return Long.MAX_VALUE;
        }
        return result.longValue();
    }

}

class QuickScanner implements Iterator<String>, Closeable {
    BufferedReader reader;
    StringTokenizer tokenizer;
    boolean endOfFile = false;

    public QuickScanner(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = null;
    }

    public boolean hasNext() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                checkNext();
            } catch (NoSuchElementException ignored) {
            }

        }
        return !endOfFile;
    }

    private void checkNext() {
        if (endOfFile) {
            throw new NoSuchElementException();
        }
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (Exception e) {
            endOfFile = true;
            throw new NoSuchElementException();
        }
    }

    public String next() {
        checkNext();
        return tokenizer.nextToken();
    }

    public void remove() {
        throw new UnsupportedOperationException();
    }

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

    public void close() {
        try {
            reader.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }


}

class ExtendedPrintWriter extends PrintWriter {


    public ExtendedPrintWriter(Writer out) {
        super(out);
    }

    public ExtendedPrintWriter(OutputStream out) {
        super(out);
    }

    }

