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 MOD = 7 + 1e9;
const long double BIG = log10(2e18);
vector<unsigned long long> v;
vector<unsigned long long> need[1000000];
int a[20];
long double b[20], sum[1000000];
unsigned long long POW(unsigned long long a, unsigned long long b) {
  if (b == 0) return 1;
  unsigned long long x = POW(a, b / 2);
  if (b & 1) return x * x * a;
  return x * x;
}
int solve(int n) {
  int c = 0, j, i, k, h, m, p, q, u, r;
  for (j = 2; 2 * j <= n; ++j) {
    if (j > n) break;
    for (i = 2; 2 * i <= n; ++i) {
      if (i * j > n) break;
      if (i * j == n) {
        need[c].push_back(i);
        need[c].push_back(j);
        ++c;
      }
    }
  }
  for (k = 2; 2 * k <= n; ++k) {
    if (k > n) break;
    for (j = 2; 2 * j <= n; ++j) {
      if (k * j > n) break;
      for (i = 2; 2 * i <= n; ++i) {
        if (i * j * k > n) break;
        if (i * j * k == n) {
          need[c].push_back(i);
          need[c].push_back(j);
          need[c].push_back(k);
          ++c;
        }
      }
    }
  }
  for (m = 2; 2 * m <= n; ++m) {
    if (m > n) break;
    for (k = 2; 2 * k <= n; ++k) {
      if (k * m > n) break;
      for (j = 2; 2 * j <= n; ++j) {
        if (k * j * m > n) break;
        for (i = 2; 2 * i <= n; ++i) {
          if (i * j * k * m > n) break;
          if (i * j * k * m == n) {
            need[c].push_back(i);
            need[c].push_back(j);
            need[c].push_back(k);
            need[c].push_back(m);
            ++c;
          }
        }
      }
    }
  }
  for (h = 2; 2 * h <= n; ++h) {
    if (h > n) break;
    for (m = 2; 2 * m <= n; ++m) {
      if (m * h > n) break;
      for (k = 2; 2 * k <= n; ++k) {
        if (k * m * h > n) break;
        for (j = 2; 2 * j <= n; ++j) {
          if (k * j * m * h > n) break;
          for (i = 2; 2 * i <= n; ++i) {
            if (i * j * k * m * h > n) break;
            if (i * j * k * m * h == n) {
              need[c].push_back(i);
              need[c].push_back(j);
              need[c].push_back(k);
              need[c].push_back(m);
              need[c].push_back(h);
              ++c;
            }
          }
        }
      }
    }
  }
  for (p = 2; 2 * p <= n; ++p) {
    if (p > n) break;
    for (h = 2; 2 * h <= n; ++h) {
      if (h * p > n) break;
      for (m = 2; 2 * m <= n; ++m) {
        if (m * h * p > n) break;
        for (k = 2; 2 * k <= n; ++k) {
          if (k * m * h * p > n) break;
          for (j = 2; 2 * j <= n; ++j) {
            if (k * j * m * h * p > n) break;
            for (i = 2; 2 * i <= n; ++i) {
              if (i * j * k * m * h * p > n) break;
              if (i * j * k * m * h * p == n) {
                need[c].push_back(i);
                need[c].push_back(j);
                need[c].push_back(k);
                need[c].push_back(m);
                need[c].push_back(h);
                need[c].push_back(p);
                ++c;
              }
            }
          }
        }
      }
    }
  }
  for (u = 2; 2 * u <= n; ++u) {
    if (u > n) break;
    for (p = 2; 2 * p <= n; ++p) {
      if (p * u > n) break;
      for (h = 2; 2 * h <= n; ++h) {
        if (h * p * u > n) break;
        for (m = 2; 2 * m <= n; ++m) {
          if (m * h * p * u > n) break;
          for (k = 2; 2 * k <= n; ++k) {
            if (k * m * h * p * u > n) break;
            for (j = 2; 2 * j <= n; ++j) {
              if (k * j * m * h * p * u > n) break;
              for (i = 2; 2 * i <= n; ++i) {
                if (i * j * k * m * h * p * u > n) break;
                if (i * j * k * m * h * p * u == n) {
                  need[c].push_back(i);
                  need[c].push_back(j);
                  need[c].push_back(k);
                  need[c].push_back(m);
                  need[c].push_back(h);
                  need[c].push_back(p);
                  need[c].push_back(u);
                  ++c;
                }
              }
            }
          }
        }
      }
    }
  }
  for (q = 2; 2 * q <= n; ++q) {
    if (q > n) break;
    for (u = 2; 2 * u <= n; ++u) {
      if (u * q > n) break;
      for (p = 2; 2 * p <= n; ++p) {
        if (p * u * q > n) break;
        for (h = 2; 2 * h <= n; ++h) {
          if (h * p * u * q > n) break;
          for (m = 2; 2 * m <= n; ++m) {
            if (m * h * p * u * q > n) break;
            for (k = 2; 2 * k <= n; ++k) {
              if (k * m * h * p * u * q > n) break;
              for (j = 2; 2 * j <= n; ++j) {
                if (k * j * m * h * p * u * q > n) break;
                for (i = 2; 2 * i <= n; ++i) {
                  if (i * j * k * m * h * p * u * q > n) break;
                  if (i * j * k * m * h * p * u * q == n) {
                    need[c].push_back(i);
                    need[c].push_back(j);
                    need[c].push_back(k);
                    need[c].push_back(m);
                    need[c].push_back(h);
                    need[c].push_back(p);
                    need[c].push_back(u);
                    need[c].push_back(q);
                    ++c;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  for (r = 2; 2 * r <= n; ++r) {
    if (r > n) break;
    for (q = 2; 2 * q <= n; ++q) {
      if (q * r > n) break;
      for (u = 2; 2 * u <= n; ++u) {
        if (u * q * r > n) break;
        for (p = 2; 2 * p <= n; ++p) {
          if (p * u * q * r > n) break;
          for (h = 2; 2 * h <= n; ++h) {
            if (h * p * u * q * r > n) break;
            for (m = 2; 2 * m <= n; ++m) {
              if (m * h * p * u * q * r > n) break;
              for (k = 2; 2 * k <= n; ++k) {
                if (k * m * h * p * u * q * r > n) break;
                for (j = 2; 2 * j <= n; ++j) {
                  if (k * j * m * h * p * u * q * r > n) break;
                  for (i = 2; 2 * i <= n; ++i) {
                    if (i * j * k * m * h * p * u * q * r > n) break;
                    if (i * j * k * m * h * p * u * q * r == n) {
                      need[c].push_back(i);
                      need[c].push_back(j);
                      need[c].push_back(k);
                      need[c].push_back(m);
                      need[c].push_back(h);
                      need[c].push_back(p);
                      need[c].push_back(u);
                      need[c].push_back(q);
                      need[c].push_back(r);
                      ++c;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return c;
}
int main() {
  ios::sync_with_stdio(0);
  int n, f, i, j, N1, N2;
  unsigned long long ans = 1, ANS = 7 * (1e18);
  cin >> n;
  for (i = 2; i < 48; ++i) {
    f = 1;
    for (j = 2; j * j <= i; ++j)
      if (i % j == 0) {
        f = 0;
        break;
      }
    if (f) v.push_back(i);
  }
  if (n <= 2) {
    cout << n;
    return 0;
  }
  f = 1;
  for (i = 2; i * i <= n; ++i)
    if (n % i == 0) {
      f = 0;
      break;
    }
  if (f) {
    cout << POW(2, n - 1);
    return 0;
  }
  for (i = 0; i < 12; ++i) b[i] = log10(v[i]);
  N1 = v.size();
  int c = solve(n);
  for (i = 0; i < c; ++i) {
    sort(need[i].begin(), need[i].end());
    reverse(need[i].begin(), need[i].end());
    for (j = 0; j < need[i].size(); ++j) {
      sum[i] += b[j] * (need[i][j] - 1);
    }
  }
  for (i = 0; i < c; ++i) {
    ans = 1;
    if (sum[i] > BIG) {
      continue;
    }
    for (j = 0; j < need[i].size(); ++j) {
      ans *= POW(v[j], need[i][j] - 1);
      if (ans > 5e18) {
        ans = 7 * 1e18;
        break;
      }
    }
    ANS = min(ans, ANS);
  }
  cout << ANS;
}
