#include <bits/stdc++.h>
using namespace std;
long long m;
long long get(long long i) {
  long long ans = 0;
  for (long long k = 2; k <= cbrt(i); k++) {
    ans += i / (k * k * k);
  }
  return ans;
}
int main() {
  cin >> m;
  long long l = 8, r = 1e17;
  while (r - l > 1) {
    long long mid = r + l;
    mid /= 2;
    long long ans = get(mid);
    if (ans >= m)
      r = mid;
    else
      l = mid;
  }
  if (get(l) == m)
    cout << l << endl;
  else if (get(r) == m)
    cout << r << endl;
  else
    cout << "-1" << endl;
}
