#include <bits/stdc++.h>
using namespace std;
long long m;
inline long long Nr(long long n) {
  long long cnt = 0, k, lim, put;
  for (k = 2; 1LL * k * k * k <= n; ++k) {
    put = 1LL * k * k * k;
    lim = n / put;
    if (1LL * lim * put > n) --lim;
    if (1LL * (lim + 1) * put <= n) ++lim;
    cnt += lim;
  }
  return cnt;
}
int main() {
  int i, j, x, y;
  cin >> m;
  long long st = 0, dr = 100000000000000000LL, mij, sol = -1;
  while (st <= dr) {
    mij = (st + dr) / 2;
    long long x = Nr(mij);
    if (x > m)
      dr = mij - 1;
    else if (x < m)
      st = mij + 1;
    else {
      sol = mij;
      dr = mij - 1;
    }
  }
  cout << sol;
  return 0;
}
