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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class _27E {

  static int n;
  static boolean[] is = new boolean[1111111];
  static int[] factor;
  static {
    Arrays.fill(is, true);
    is[0] = is[1] = false;
    for (int i = 2; i * i < is.length; i++)
      if (is[i])
        for (int j = i + i; j < is.length; j += i)
          is[j] = false;
    int cnt = 0;
    for (int i = 0; i < is.length; i++)
      if (is[i])
        cnt++;
    factor = new int[cnt];
    int ptr = 0;
    for (int i = 0; i < is.length; i++)
      if (is[i])
        factor[ptr++] = i;
  }

  static class State {
    Map<Integer, Integer> map;
    int factorIndex;

    @Override
    public int hashCode() {
      int ans = 17;
      ans = ans * 31 + map.hashCode();
      ans = ans * 31 + factorIndex;
      return ans;
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj)
        return true;
      else if (!(obj instanceof State))
        return false;
      else {
        State other = (State) obj;
        return map.equals(other.map) && factorIndex == other.factorIndex;
      }
    }

    @Override
    public String toString() {
      return String.format("%s %d", map.toString(), factorIndex);
    }
  }

  static BigInteger MAX = BigInteger.valueOf(1000000000000000000L + 5);
  static Map<State, BigInteger> f = new HashMap<>();

  static BigInteger F(State state) {
    if (f.containsKey(state))
      return f.get(state);

    boolean terminate = true;
    for (int i : state.map.values())
      if (i > 0) {
        terminate = false;
        break;
      }

    BigInteger ans = MAX;
    if (terminate)
      ans = BigInteger.ONE;
    else {
      BigInteger fac = BigInteger.valueOf(factor[state.factorIndex]);
      for (Map.Entry<Integer, Integer> entry : state.map.entrySet()) {
        for (int j = 1, exponent = entry.getKey(); j <= entry.getValue(); j++, exponent *= entry.getKey()) {
          BigInteger prod = fac.pow(exponent - 1);
          Map<Integer, Integer> newMap = new HashMap<>(state.map);
          newMap.put(entry.getKey(), entry.getValue() - j);

          State newState = new State();
          newState.map = newMap;
          newState.factorIndex = state.factorIndex + 1;

          BigInteger tmp = prod.multiply(F(newState));
          if (tmp.compareTo(ans) < 0)
            ans = tmp;
        }
      }
    }

    f.put(state, ans);
    return ans;
  }

  public static void main(String[] args) throws Exception {
    Reader.init(System.in);
    BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));

    n = Reader.nextInt();
    int nn = n;
    Map<Integer, Integer> map = new HashMap<>();
    for (int i = 0; i < factor.length && factor[i] <= nn; i++)
      if (nn % factor[i] == 0) {
        int cnt = 0;
        while (nn % factor[i] == 0) {
          cnt++;
          nn /= factor[i];
        }
        map.put(factor[i], cnt);
      }
    State state = new State();
    state.map = map;
    state.factorIndex = 0;
    System.out.println(F(state));

    cout.close();
  }

  static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
    final U _1;
    final V _2;

    private Pair(U key, V val) {
      this._1 = key;
      this._2 = val;
    }

    public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {
      return new Pair<U, V>(_1, _2);
    }

    @Override
    public String toString() {
      return _1 + " " + _2;
    }

    @Override
    public int hashCode() {
      int res = 17;
      res = res * 31 + _1.hashCode();
      res = res * 31 + _2.hashCode();
      return res;
    }

    @Override
    public int compareTo(Pair<U, V> that) {
      int res = this._1.compareTo(that._1);
      if (res < 0 || res > 0)
        return res;
      else
        return this._2.compareTo(that._2);
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj)
        return true;
      if (!(obj instanceof Pair))
        return false;
      Pair<?, ?> that = (Pair<?, ?>) obj;
      return _1.equals(that._1) && _2.equals(that._2);
    }
  }

  /** Class for buffered reading int and double values */
  static class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
      reader = new BufferedReader(new InputStreamReader(input));
      tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
      while (!tokenizer.hasMoreTokens()) {
        // TODO add check for eof if necessary
        tokenizer = new StringTokenizer(reader.readLine());
      }
      return tokenizer.nextToken();
    }

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

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

  static class ArrayUtil {
    static void swap(int[] a, int i, int j) {
      int tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(long[] a, int i, int j) {
      long tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(double[] a, int i, int j) {
      double tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(char[] a, int i, int j) {
      char tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void swap(boolean[] a, int i, int j) {
      boolean tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
    }

    static void reverse(int[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(long[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(double[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(char[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static void reverse(boolean[] a, int i, int j) {
      for (; i < j; i++, j--)
        swap(a, i, j);
    }

    static long sum(int[] a) {
      int sum = 0;
      for (int i : a)
        sum += i;
      return sum;
    }

    static long sum(long[] a) {
      long sum = 0;
      for (long i : a)
        sum += i;
      return sum;
    }

    static double sum(double[] a) {
      double sum = 0;
      for (double i : a)
        sum += i;
      return sum;
    }

    static int max(int[] a) {
      int max = Integer.MIN_VALUE;
      for (int i : a)
        if (i > max)
          max = i;
      return max;
    }

    static int min(int[] a) {
      int min = Integer.MAX_VALUE;
      for (int i : a)
        if (i < min)
          min = i;
      return min;
    }

    static long max(long[] a) {
      long max = Long.MIN_VALUE;
      for (long i : a)
        if (i > max)
          max = i;
      return max;
    }

    static long min(long[] a) {
      long min = Long.MAX_VALUE;
      for (long i : a)
        if (i < min)
          min = i;
      return min;
    }
  }
}
