#include <bits/stdc++.h>
using namespace std;
const long long LLINF = 1e16 + 11;
inline long long pow3(long long x) { return x * x * x; }
long long pack(long long n) {
  long long ret = 0;
  for (long long x = 2; pow3(x) <= n; ++x) ret += n / pow3(x);
  return ret;
}
int main() {
  long long m;
  cin >> m;
  long long lo = 2, hi = LLINF;
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    if (pack(mid) < m)
      lo = mid + 1;
    else
      hi = mid;
  }
  if (pack(lo) == m)
    cout << lo << endl;
  else
    cout << -1 << endl;
  return 0;
}
