#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m;
  scanf("%lld", &m);
  long long lo = 1, hi = 100000000000000000ll, mid;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    long long Sum = 0;
    for (long long k = 2; k * k * k <= mid; ++k) {
      Sum += (mid / (k * k * k));
      if (Sum > m) Sum = m + 1;
    }
    if (Sum >= m)
      hi = mid;
    else
      lo = mid + 1;
  }
  mid = lo;
  long long Sum = 0;
  for (long long k = 2; k * k * k <= mid; ++k) {
    Sum += (mid / (k * k * k));
    if (Sum > m) Sum = m + 1;
  }
  if (Sum == m)
    printf("%lld\n", mid);
  else
    printf("-1\n");
}
