#include <bits/stdc++.h>
using namespace std;
long long n;
const long long INF = 1e16;
long long solve(long long x) {
  long long num = 0;
  for (long long k = 2; k <= x; k++) {
    if (k * k * k <= x)
      num += x / (k * k * k);
    else
      break;
  }
  return num;
}
int main() {
  scanf("%I64d", &n);
  long long ans = INF;
  long long le = 1, ri = INF, mi;
  for (int i = 0; i < 100; i++) {
    mi = (le + ri) / 2;
    long long jj = solve(mi);
    if (jj == n) {
      ans = min(ans, mi);
      ri = mi;
    } else if (jj < n)
      le = mi;
    else
      ri = mi;
  }
  if (ans == INF)
    printf("-1\n");
  else
    printf("%I64d\n", ans);
  return 0;
}
