#include <bits/stdc++.h>
using namespace std;
long long berch(long long n) {
  long long lo = 1, mid, moo;
  long long hi = 100000000000000099;
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    long long sum = 0;
    for (long long i = 2; i <= sqrt(mid); i++) {
      moo = mid / (i * i * i);
      if (moo == 0) {
        break;
      } else {
        sum += moo;
      }
    }
    if (sum >= n) {
      hi = mid;
    } else if (sum < n) {
      lo = mid + 1;
    }
    if (lo == hi) {
      break;
    }
  }
  return lo;
}
int main() {
  long long n;
  cin >> n;
  long long boi;
  long long maus = 0;
  boi = berch(n);
  long long mooo;
  for (long long i = 2; i <= sqrt(boi); i++) {
    mooo = boi / (i * i * i);
    if (mooo == 0) {
      break;
    } else {
      maus += mooo;
    }
  }
  if (maus != n) {
    cout << -1;
  } else {
    cout << boi;
  }
  return 0;
}
