#include <bits/stdc++.h>
using namespace std;
long long ileOpcji(long long n) {
  long long wyn = 0;
  for (long long k = 2; k * k * k <= n; k++) {
    wyn += n / (k * k * k);
  }
  return wyn;
}
int main() {
  long long n;
  cin >> n;
  long long p = 0, q = 1e18;
  while (p < q) {
    long long s = (p + q) / 2;
    if (ileOpcji(s) >= n)
      q = s;
    else
      p = s + 1;
  }
  if (ileOpcji(p) == n)
    cout << p;
  else
    cout << "-1";
  return 0;
}
