#include <bits/stdc++.h>
using namespace std;
int n;
unsigned long long ans;
const unsigned long long INF = ~0ULL;
int prime[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
void dfs(int dept, unsigned long long tmp, int num) {
  if (num > n || dept > 15) return;
  if (num == n && ans > tmp) {
    ans = tmp;
    return;
  }
  for (int i = 1; i < 64; i++) {
    if (ans / prime[dept] < tmp || num * (i + 1) > n) break;
    dfs(dept + 1, tmp *= prime[dept], num * (i + 1));
  }
}
int main() {
  while (cin >> n) {
    ans = INF;
    dfs(0, 1, 1);
    cout << ans << endl;
  }
  return 0;
}
