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 std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::istream;
using std::map;
using std::ostream;
using std::set;
using std::string;
using std::vector;
ostream &operator<<(ostream &os, const unsigned char v) {
  os << (int)v;
  return os;
}
istream &operator>>(istream &is, unsigned char &v) {
  int tmp;
  is >> tmp;
  v = (unsigned char)tmp;
  return is;
}
template <class T>
T min(T a, T b) {
  return (a < b) ? a : b;
}
int pmod(int a, int b) {
  if (b < 0) {
    return pmod(-a, -b);
  }
  int ret = a % b;
  if (ret < 0) ret += b;
  return ret;
}
const long long int MAX_V = 1e18 + 1;
int primes[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
long long int dp[1001][10 + 1];
vector<int> div_vs[1001];
long long int pow_v[10][1001];
int n;
int main(int argc, const char *argv[]) {
  scanf("%d", &n);
  for (int divisor = 2; divisor <= n; divisor += 1) {
    for (int dividend = divisor, q = 1; dividend <= n;
         dividend += divisor, q += 1) {
      div_vs[dividend].push_back(divisor);
    }
  }
  for (int i = 0; i < 10; i++) {
    pow_v[i][0] = 1;
    long long int pre_max_v = MAX_V / primes[i];
    int j;
    for (j = 1; j <= n - 1 && pow_v[i][j - 1] <= pre_max_v; j++) {
      pow_v[i][j] = pow_v[i][j - 1] * primes[i];
    }
  }
  dp[1][0] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= 10; j++) {
      long long int cur = MAX_V;
      for (int x = 0; x < div_vs[i].size(); x++) {
        int k = div_vs[i][x] - 1;
        int ui = i / (k + 1);
        if (pow_v[j - 1][k] != 0 && MAX_V / pow_v[j - 1][k] > dp[ui][j - 1] &&
            dp[ui][j - 1] != 0) {
          cur = min(cur, dp[ui][j - 1] * pow_v[j - 1][k]);
        }
      }
      if (cur < MAX_V) dp[i][j] = cur;
    }
  }
  long long int res = MAX_V;
  for (int j = 0; j <= 10; j++) {
    if (dp[n][j] != 0) res = std::min(dp[n][j], res);
  }
  cout << res << endl;
  return 0;
}
