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;
double PI = acos(-1);
int dp[1005][12];
int prime[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
long long power(int x, int y) {
  if (y == 0) return 1;
  if (y % 2) return x * power(x, y / 2) * power(x, y / 2);
  return power(x, y / 2) * power(x, y / 2);
}
long long calc(vector<int> arr, int n) {
  long long ans = 1;
  long long ans2 = 1;
  for (int i = 1; i <= 10; i++) {
    long long x = prime[i - 1];
    for (int j = 0; j < arr[i]; j++) {
      if (ans * x > 1e18) return 2e18;
      ans *= x;
    }
  }
  for (int i = 1; i <= 10; i++) ans2 *= arr[i] + 1;
  if (ans2 != n) return 2e18;
  return ans;
}
vector<int> solve(int x, int y, int n) {
  vector<int> temp(11);
  long long minn = 2e18;
  for (int i = 1; i <= 10; i++) temp[i] = dp[x][i];
  for (int i = 1; i <= 10; i++) {
    if (dp[x][i] == 0) {
      temp[i] += y - 1;
      minn = min(minn, calc(temp, n));
      temp[i] -= y - 1;
      break;
    } else {
      temp[i] += y;
      minn = min(minn, calc(temp, n));
      temp[i] -= y;
    }
  }
  for (int i = 1; i <= 10; i++) {
    if (dp[x][i] == 0) {
      temp[i] += y - 1;
      if (minn == calc(temp, n)) return temp;
      temp[i] -= y - 1;
      break;
    } else {
      temp[i] += y;
      if (minn == calc(temp, n)) return temp;
      temp[i] -= y;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long ans = 1;
  for (int i = 2; i <= n; i++) {
    int x = i;
    vector<int> fac;
    long long minn = 2e18;
    for (int j = 2; j * j <= i; j++) {
      while (x % j == 0) {
        fac.push_back(j);
        x /= j;
      }
    }
    if (x > 1) fac.push_back(x);
    vector<int> temp(11);
    for (int j = 0; j < fac.size(); j++) {
      if (minn >= calc(solve(i / fac[j], fac[j], i), i)) {
        minn = calc(solve(i / fac[j], fac[j], i), i);
        temp = solve(i / fac[j], fac[j], i);
      }
    }
    for (int j = 1; j <= 10; j++) dp[i][j] = temp[j];
  }
  for (int i = 1; i <= 10; i++) ans *= power(prime[i - 1], dp[n][i]);
  cout << ans << '\n';
  return 0;
}
