#include <bits/stdc++.h>
using namespace std;
long long binary(long long mid) {
  long long i = 2, possibilities = 0;
  while (i * i * i <= mid) {
    possibilities += mid / (i * i * i);
    i++;
  }
  return possibilities;
}
int main() {
  long long m, min, max;
  scanf("%I64d", &m);
  min = -1;
  max = 1e17;
  while (max > min + 1) {
    long long mid = (min + max) / 2;
    if (binary(mid) >= m) {
      max = mid;
    } else {
      min = mid;
    }
  }
  if (binary(max) == m) {
    printf("%I64d\n", max);
  } else {
    printf("-1\n");
  }
  return 0;
}
