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;
int d[11] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
int f[1007];
int build[1007];
int cnt = 0;
int spt;
int n;
long long res = LONG_LONG_MAX;
long long mu(long long s, int x, int y) {
  for (int i = 1; i <= y; i++) {
    if (s > 1e18 / x)
      return 0;
    else
      s = s * x;
  }
  return s;
}
void xl(int i) {
  int dem = 0;
  long long sct = 1;
  for (int j = 1; j <= i; j++) {
    sct = mu(sct, d[j - 1], build[j] - 1);
    if (sct == 0)
      break;
    else
      dem++;
  }
  if (sct != 0) res = min(res, sct);
}
void snp(int i, int sum) {
  if (i > cnt) return;
  if (sum > n) return;
  for (int j = 1; j <= cnt; j++) {
    build[i] = f[j];
    sum = 1;
    for (int k = 1; k <= i; k++) {
      sum = sum * build[k];
    }
    if (sum == n) {
      xl(i);
      snp(i + 1, sum);
    } else
      snp(i + 1, sum);
  }
}
int main() {
  cin >> n;
  if (n == 1) {
    cout << 1;
    return 0;
  }
  for (int i = n; i >= 2; i--)
    if (n % i == 0) f[++cnt] = i;
  spt = int(log10(n) / log10(2));
  snp(1, 1);
  cout << res;
  return 0;
}
