#include <bits/stdc++.h>
using namespace std;
unsigned long long ans;
int n;
int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 53};
void dfs(int pos, unsigned long long value, int num) {
  if (num > n || pos > 15) return;
  if (num == n) {
    if (value < ans) ans = value;
    return;
  }
  for (int i = 1; i <= 63; i++) {
    if (value > ans / prime[pos] || num * (i + 1) > n) break;
    value = value * prime[pos];
    if (n % (num * (i + 1)) == 0) dfs(pos + 1, value, num * (i + 1));
  }
}
int main() {
  while (~scanf("%d", &n)) {
    ans = 1ull << 63;
    dfs(0, 1, 1);
    cout << ans << endl;
  }
  return 0;
}
