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;
unsigned long long ToInt(string s) {
  unsigned long long r = 0;
  stringstream sin(s);
  sin >> r;
  return r;
}
string ToString(unsigned long long n) {
  string s;
  stringstream convert;
  convert << n;
  s = convert.str();
  return s;
}
const int mx = 1000000 + 100;
bool check[mx + 100];
unsigned long long save[mx + 100];
map<int, int> mp;
vector<int> prime;
char sieve[mx];
void primeSieve(int n) {
  sieve[0] = sieve[1] = 1;
  prime.push_back(2);
  for (int i = 4; i <= n; i += 2) sieve[i] = 1;
  int sqrtn = sqrt(n);
  for (int i = 3; i <= sqrtn; i += 2) {
    if (sieve[i] == 0) {
      for (int j = i * i; j <= n; j += 2 * i) sieve[j] = 1;
    }
  }
  for (int i = 3; i <= n; i += 2)
    if (sieve[i] == 0) prime.push_back(i);
}
long long eulerPhi(long long n) {
  long long res = n;
  long long sqrtn = sqrt(n);
  for (int i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
      }
      sqrtn = sqrt(n);
      res /= prime[i];
      res *= prime[i] - 1;
    }
  }
  if (n != 1) {
    res /= n;
    res *= n - 1;
  }
  return res;
}
int bigmodRecur(int b, int p, int m) {
  if (p == 0) return 1 % m;
  if (p % 2 == 0) {
    int y = bigmodRecur(b, p / 2, m);
    return (y * y) % m;
  } else {
    return (b * bigmodRecur(b, p - 1, m)) % m;
  }
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    gcd(b, a % b);
}
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
vector<int> factors;
map<int, int> pm;
vector<int> ok;
void factorize(long long n) {
  int sqrtn = sqrt(n);
  for (int i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    int cnt = 0;
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
        cnt++;
        ok.push_back(prime[i]);
      }
      factors.push_back(prime[i]);
      sqrtn = sqrt(n);
    }
  }
  if (n != 1) {
    factors.push_back(n);
    ok.push_back(n);
  }
}
long long factFactorize(int n) {
  long long ans = 1;
  for (int i = 0; i < prime.size() && prime[i] <= n; i++) {
    int x = n;
    int freq = 0;
    int cnt = 0;
    while (x / prime[i]) {
      freq += x / prime[i];
      x = x / prime[i];
    }
    pm[prime[i]] = freq;
    if (mp[prime[i]]) {
      ans *= (freq - mp[prime[i]] + 1);
    } else
      ans *= (freq + 1);
  }
  return ans;
}
int NOD(int n) {
  int sqrtn = sqrt(n);
  int res = 1;
  for (int i = 0; i < prime.size() && prime[i] <= sqrtn; i++) {
    if (n % prime[i] == 0) {
      int p = 0;
      while (n % prime[i] == 0) {
        n /= prime[i];
        p++;
      }
      sqrtn = sqrt(n);
      p++;
      res *= p;
    }
  }
  if (n != 1) {
    res *= 2;
  }
  return res;
}
vector<int> arr;
long long poww(long long p, long long q) {
  long long x = 1;
  for (int i = 1; i <= q; i++) {
    if (x > (1e18 / p))
      return -1;
    else {
      x *= p;
    }
  }
  return x;
}
long long dp[50][15];
long long solve(int i, int j) {
  if (i >= ok.size() || j >= arr.size()) return 1;
  if (dp[i][j] != -1) return dp[i][j];
  long long mn = 1e18 + 10, x = 1, y = 1;
  for (int k = i; k < ok.size(); k++) {
    x *= ok[k];
    y = poww(arr[j], x - 1);
    if (y == -1) break;
    if (y > (1e18 / solve(k + 1, j + 1))) {
      break;
    } else {
      y = y * solve(k + 1, j + 1);
    }
    mn = min(mn, y);
  }
  return dp[i][j] = mn;
}
int main() {
  primeSieve(1000000 + 10);
  memset(&dp, -1, sizeof(dp));
  int n;
  cin >> n;
  for (int i = 0; i < prime.size(); i++) {
    arr.push_back(prime[i]);
    if (i > 11) break;
  }
  factorize(n);
  reverse(ok.begin(), ok.end());
  cout << solve(0, 0) << endl;
}
