#include <bits/stdc++.h>
using namespace std;
long long f(long long k) {
  long long r = 0;
  for (long long i = 2;; ++i) {
    long long w = k / i / i / i;
    if (!w) break;
    r += w;
  }
  return r;
}
int main() {
  long long m;
  cin >> m;
  long long s = 7, e = 1e16;
  while (e - s > 1) {
    long long k = (s + e) / 2;
    if (f(k) < m)
      s = k;
    else
      e = k;
  }
  s++;
  if (f(s) == m)
    cout << s << endl;
  else
    puts("-1");
  return 0;
}
