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;
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T min(T a, T b, T c, T d) {
  return min(a, min(b, min(c, d)));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T max(T a, T b, T c, T d) {
  return max(a, max(b, max(c, d)));
}
bool cmp(const int &a, const int &b) { return a > b; }
long long GCD(long long a, long long b) { return (a % b) ? GCD(b, a % b) : b; }
long long f[1027][5 * 1027];
long long power(int n, int k) {
  long long res = 1LL;
  for (int i = (1); i <= (k); ++i) {
    if (res > 1000000000000000007LL / n) return 1000000000000000007LL + 1LL;
    res *= n;
  }
  return res;
}
bool inBit(int i, int j) { return (1 << j) & i; }
int addBit(int i, int j) { return (1 << j) | i; }
int main() {
  int n;
  scanf("%d", &n);
  vector<int> vc;
  int _n = n;
  for (int i = (2); i <= (n); ++i) {
    if (n % i == 0) {
      vc.push_back(i);
    }
  }
  vector<int> primes;
  n = _n;
  for (int i = (2); i <= (40); ++i) {
    bool check = 1;
    for (int j = (2); j <= (i - 1); ++j) {
      if (i % j == 0) {
        check = 0;
        break;
      }
    }
    if (check) primes.push_back(i);
  }
  for (int i = (1); i <= (n); ++i) {
    for (int j = (0); j <= ((1 << 12) - 1); ++j)
      f[i][j] = 1000000000000000007LL;
  }
  f[1][0] = 1LL;
  long long ans = 1000000000000000007LL;
  for (int i = (1); i <= (n); ++i) {
    for (int bit = (0); bit <= ((1 << 12) - 1); ++bit) {
      if (f[i][bit] == 1000000000000000007LL) continue;
      for (int j = (0); j <= ((int)vc.size() - 1); ++j) {
        if (i * vc[j] > n) continue;
        for (int k = (0); k <= ((int)primes.size() - 1); ++k) {
          int new_i = i * vc[j];
          int new_bit = addBit(bit, k);
          if (!inBit(bit, k)) {
            if (f[i][bit] > 1000000000000000007LL / power(primes[k], vc[j] - 1))
              continue;
            f[new_i][new_bit] =
                min(f[new_i][new_bit], f[i][bit] * power(primes[k], vc[j] - 1));
          }
        }
      }
      ans = min(ans, f[n][bit]);
    }
  }
  cout << ans << endl;
  return 0;
}
