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;
const int maxn = 1e6 + 10;
const int maxn5 = 2e3 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
long long dp[maxn5][20], pw[20][maxn5];
bool notprime[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n;
  int ind = 1;
  k = 14;
  for (int i = 2; i < maxn; i++)
    if (!notprime[i]) {
      if (ind <= k) pw[ind][0] = 1;
      if (ind <= k)
        for (int j = 1; j <= n; j++) {
          pw[ind][j] = pw[ind][j - 1] * i;
          if (pw[ind][j - 1] > inf / i + 1) pw[ind][j] = inf;
        }
      for (int j = 2 * i; j < maxn; j += i) {
        notprime[j] = true;
      }
      ind++;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= k; j++) dp[i][j] = inf;
  for (int i = 0; i <= k; i++) dp[1][i] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= k; j++)
      for (int r = 1; r <= i; r++)
        if (i % (r + 1) == 0) {
          if (dp[i / (r + 1)][j - 1] <= inf / pw[j][r] + 1)
            dp[i][j] = min(dp[i][j], dp[i / (r + 1)][j - 1] * pw[j][r]);
        }
  long long ans = inf;
  for (int i = 1; i <= k; i++) ans = min(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}
