#include <bits/stdc++.h>
using namespace std;
long long n, s, l, r;
inline long long read() {
  long long sum = 0, x = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') x = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = sum * 10 + ch - '0';
    ch = getchar();
  }
  return sum * x;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
  return;
}
inline long long ok(long long x) {
  long long res = 0;
  for (register long long i = 2; i * i * i <= x; ++i) res += x / (i * i * i);
  return res;
}
signed main() {
  n = read();
  l = 1;
  r = 1e18;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (ok(mid) >= n) {
      r = mid - 1;
      s = mid;
    } else
      l = mid + 1;
  }
  if (ok(s) == n)
    write(s);
  else
    puts("-1");
  return 0;
}
