#include <bits/stdc++.h>
using namespace std;
long long m;
long long cal(long long n) {
  long long res = 0;
  for (long long i = 2; i * i * i <= n; i++) res += n / (i * i * i);
  return res;
}
int main() {
  long long l = 0, r = 1e16;
  scanf("%I64d", &m);
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (cal(mid) >= m)
      r = mid;
    else
      l = mid + 1;
  }
  if (cal(l) == m)
    printf("%I64d", l);
  else
    printf("-1");
  return 0;
}
