#include <bits/stdc++.h>
using namespace std;
long long m;
long long f(long long x) {
  long long ans = 0;
  for (long long k = 2; k * k * k <= x; k++) {
    long long y = x / (k * k * k);
    ans += y;
  }
  return ans;
}
int main() {
  cin >> m;
  long long lo = 1, hi = 2e18;
  if (f(lo)) {
    cout << lo << endl;
    return 0;
  }
  if (!f(hi)) {
    cout << -1 << endl;
    return 0;
  }
  while (hi - lo > 1) {
    long long mi = (lo + hi) >> 1LL;
    if (f(mi) >= m)
      hi = mi;
    else
      lo = mi;
  }
  if (f(hi) != m) {
    cout << -1 << endl;
  } else
    cout << hi << endl;
  return 0;
}
