#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int a[20];   long long ans, p[] = {1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29}, limit = 1e18;   void dfs(int num, int len) {     if (num == 1) {       long long res = 1;       for (int i = 1; i <= len; ++i) {         for (int j = 1; j < a[i]; ++j) {           if (limit / p[i] <= res) {             return;           }           res *= p[i];         }       }       ans = min(ans, res);       return;     }     for (int i = 2; i <= num; ++i) {       if (num % i == 0) {         a[len + 1] = i;         dfs(num / i, len + 1);       }     }   }   int main() {     int n;     cin >> n;     if (n == 1) {       cout << 1 << endl;       return 0;     } else if (n == 2) {       cout << 2 << endl;       return 0;     }     ans = limit;     for (int i = 1; i <= n; ++i) {       if (n % i == 0) {         a[1] = i;         dfs(n / i, 1);       }     }     cout << ans << endl;     return 0;   }   