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
#include <bits/stdc++.h>
using namespace std;
const long long e = 1e5 + 110;
bool zs[e];
long long num[e];
void sai() {
  for (long long i = 2; i <= e - 99; i++) {
    if (zs[i]) continue;
    for (long long j = i + i; j <= e - 99; j += i) {
      zs[j] = true;
    }
  }
  for (long long tot = 0, i = 2; i <= e - 99; i++) {
    if (!zs[i]) tot++, num[tot] = i;
  }
}
struct fengjie {
  long long v, t;
} f[e];
long long cnf = 0;
void fj(long long x) {
  long long tmp = x;
  for (long long i = 2; i <= x; i++) {
    long long cnt = 0;
    while (tmp % i == 0) {
      tmp /= i;
      cnt++;
    }
    if (cnt == 0) continue;
    cnf++;
    f[cnf].v = i, f[cnf].t = cnt;
  }
  return;
}
long long ksm(long long a, long long z) {
  long long ret = 1;
  if (z == 0) return 1;
  while (z != 1) {
    if (z % 2 == 1) {
      ret *= a;
      a *= a;
    } else {
      a *= a;
    }
    z /= 2;
  }
  return a * ret;
}
fengjie an[e];
signed main() {
  long long n;
  cin >> n;
  sai();
  fj(n);
  long long ans = 1, g = 0, cna = 0, minn;
  for (long long i = cnf; i > 0; i--) {
    for (long long j = 1; j <= f[i].t; j++) {
      if (cna == 0) {
        g++;
        ans *= ksm(num[g], f[i].v - 1);
        an[++cna].v = num[g];
        an[cna].t = f[i].v - 1;
        continue;
      }
      long long pl = -1;
      minn = ans * ksm(num[g + 1], f[i].v - 1);
      for (long long l = 1; l <= cna; l++) {
        long long ct = f[i].v * (an[l].t + 1) - 1;
        long long tmp = ans / ksm(an[l].v, an[l].t);
        tmp *= ksm(an[l].v, ct);
        if (tmp < ans or ksm(an[l].v, ct) < an[l].v) continue;
        if (tmp < minn) {
          pl = l;
          minn = tmp;
        }
      }
      if (pl == -1) {
        g++;
        ans *= ksm(num[g], f[i].v - 1);
        an[++cna].v = num[g];
        an[cna].t = f[i].v - 1;
      }
      if (pl != -1) {
        long long tmp = ans / ksm(an[pl].v, an[pl].t);
        long long ct = f[i].v * (an[pl].t + 1) - 1;
        ans = tmp * ksm(an[pl].v, ct);
      }
    }
  }
  cout << ans;
  return 0;
}
