#include <bits/stdc++.h>
using namespace std;
long long calc_ways(long long n) {
  long long xm = 0, km = 0;
  long long ways = 0;
  for (long long k = 2; k * k * k <= n; k++) {
    long long x = n / (k * k * k);
    ways += x;
  }
  return ways;
}
long long search(long long m) {
  long long lo = 1, hi = 1e18;
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    if (calc_ways(mid) < m)
      lo = mid + 1;
    else
      hi = mid;
  }
  return lo;
}
int main() {
  long long m;
  cin >> m;
  long long n = search(m);
  if (calc_ways(n) == m)
    cout << n << '\n';
  else
    cout << -1 << '\n';
  return 0;
}
