#include <bits/stdc++.h>
long long chk[200000];
int main() {
  long long i, j, n, l, r, mid, cnt, ans;
  for (i = 1; i <= 200000; i++) {
    chk[i] = i * i * i;
  }
  scanf("%I64d", &n);
  l = 1, r = 1LL << 60;
  while (l < r) {
    mid = (l + r) / 2;
    ans = 0;
    for (i = 2; i <= 200000; i++) {
      cnt = mid / chk[i];
      ans += cnt;
    }
    if (ans >= n)
      r = mid;
    else
      l = mid + 1;
  }
  ans = 0;
  for (i = 2; i <= 200000; i++) {
    cnt = l / chk[i];
    ans += cnt;
  }
  if (ans != n)
    printf("-1");
  else
    printf("%I64d\n", l);
  return 0;
}
