#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-5;
long long llinf = 1e18 + 10;
int intinf = 1e9 + 7;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;
long long m;
long long cnt(long long n) {
  long long b = 2;
  long long run = 0;
  while (1) {
    long long q = ((b) * (b) * (b));
    long long inc = n / q;
    if (inc == 0) break;
    run += inc;
    b++;
  }
  return run;
}
int main() {
  scanf("%lld", &(m));
  long long lo = 0, hi = 1e18, md;
  while (lo < hi) {
    md = lo + ((hi - lo) >> 1);
    if (cnt(md) < m)
      lo = md + 1;
    else
      hi = md;
  }
  if (cnt(lo) == m) {
    cout << lo << endl;
  } else {
    cout << "-1\n";
  }
  return 0;
}
