#include <bits/stdc++.h>
const int MAXN = 1e6 + 10;
unsigned long long p[MAXN];
inline void init() {
  unsigned long long ans = 2;
  for (int i = 0; i < MAXN; ++i) {
    p[i] = ans * ans * ans;
    ans++;
  }
}
int main() {
  unsigned long long n;
  init();
  scanf("%lld", &n);
  unsigned long long L = 0, R = 1e16, sum, cnt = -1;
  while (R - L > 1) {
    unsigned long long mid = (L + R) >> 1;
    sum = 0;
    for (int i = 0; i < MAXN; ++i) {
      if (mid < p[i] || sum > n) break;
      sum = sum + mid / p[i];
    }
    if (sum >= n) {
      R = mid;
      if (sum == n) {
        cnt = mid;
      }
    } else
      L = mid;
  }
  if (cnt > 0)
    printf("%lld\n", cnt);
  else
    printf("-1\n");
  return 0;
}
