#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
long long chk(long long x) {
  long long ways = 0;
  for (long long i = 2; (i * i * i) <= x; i++) ways += (x / (i * i * i));
  return ways;
}
void solve() {
  long long m;
  scanf("%lld", &m);
  long long lo = 1, hi = 1e18;
  while (lo < hi) {
    long long mid = (lo + hi) / (2ll);
    if (chk(mid) >= m) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  if (chk(lo) != m)
    printf("-1");
  else
    cout << lo;
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
