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