#include <bits/stdc++.h>
using namespace std;
long long m;
long long Check(long long n) {
  long long cnt = 0;
  for (long long i = 2;; i++) {
    if (i * i > n / i) break;
    cnt += n / (i * i * i);
  }
  return cnt;
}
int main() {
  scanf("%lld", &m);
  long long x = -1, y = m * 8 + 1;
  while (x + 1 < y) {
    long long mid = (x + y) / 2;
    if (Check(mid) < m)
      x = mid;
    else
      y = mid;
  }
  if (Check(x + 1) != m)
    printf("-1");
  else
    printf("%lld", x + 1);
  return 0;
}
