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;
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
template <typename T, typename U>
static void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
vector<int> fact[1001];
vector<long long> prime;
void calc() {
  for (int(i) = (int)(2); (i) <= (int)(1000); ++(i))
    if (fact[i].empty())
      for (int j = i; j <= 1000; j += i) {
        int tmp = j;
        while (tmp % i == 0) {
          fact[j].push_back(i);
          tmp /= i;
        }
      }
  for (int(i) = (int)(2); (i) <= (int)(1000); ++(i))
    if (fact[i].size() == 1) prime.push_back(i);
}
int num(vector<pair<long long, long long> > &fac) {
  int ans = 1;
  for (auto el : fac) ans *= el.second + 1LL;
  return ans;
}
int checkn(long long res) {
  int anst = 1;
  vector<pair<long long, int> > facr;
  for (long long i = 2; i * i <= res; i++) {
    if (res % i == 0) {
      facr.push_back(make_pair(i, 1));
      res /= i;
      while (res % i == 0) facr.back().second++, res /= i;
    }
  }
  if (res != 1) facr.push_back(make_pair(res, 1));
  for (int(i) = 0; (i) < (int)(facr.size()); ++(i)) {
    cout << facr[i].first << ' ' << facr[i].second << endl;
    anst *= facr[i].second + 1;
  }
  return anst;
}
vector<pair<long long, long long> > res;
long long ans = 1;
long long answ = INFL;
int n;
bool found = false;
void go(int ind, int prind) {
  int tmp = num(res);
  if (tmp == n && ans < answ) {
    answ = ans;
    return;
  }
  if (ind == res.size() && tmp * 2LL <= n) {
    res.push_back(make_pair(prime[prind], 1));
    ans *= prime[prind];
    prind++;
    tmp *= 2LL;
  }
  if (tmp == n && ans < answ) {
    answ = ans;
    if (ind == res.size() - 1 && res.back().second == 1) {
      ans /= res.back().first;
      prind--;
      res.pop_back();
    }
    return;
  }
  if (ind >= res.size() || tmp > n) return;
  if (INFL / res[ind].first + 1 <= ans || ans >= (long long)1e18 ||
      ans * res[ind].first <= 0 || ans * res[ind].first >= (long long)1e18) {
    if (ind == res.size() - 1 && res.back().second == 1) {
      ans /= res.back().first;
      prind--;
      res.pop_back();
    }
    return;
  }
  res[ind].second++;
  ans *= res[ind].first;
  go(ind, prind);
  res[ind].second--;
  ans /= res[ind].first;
  go(ind + 1, prind);
  if (ind == res.size() - 1 && res.back().second == 1) {
    ans /= res.back().first;
    prind--;
    res.pop_back();
  }
}
int main() {
  calc();
  cin >> n;
  go(0, 0);
  cout << answ << endl;
  return 0;
}
