#include <bits/stdc++.h>
using namespace std;
long long m;
long long p(long long x) {
  long long kmx = 0;
  while ((kmx * kmx * kmx) <= x) kmx++;
  kmx--;
  long long ret = 0;
  for (long long i = 2; i <= kmx; i++) ret += x / (i * i * i);
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> m;
  long long ans = 0;
  long long lo = 1, hi = 1e16;
  while (lo <= hi) {
    long long mi = (lo + hi) / 2;
    if (p(mi) >= m) {
      ans = mi;
      hi = mi - 1;
    } else
      lo = mi + 1;
  }
  if (p(ans) != m) ans = -1;
  cout << ans << '\n';
  return 0;
}
