#include <bits/stdc++.h>
using namespace std;
long long m;
bool cal(long long x) {
  long long ncount = 0;
  for (long long q = 2;; q++) {
    long long q3 = q * q * q;
    if (q3 > x) break;
    ncount += x / q3;
    if (ncount >= m) return true;
  }
  if (ncount >= m)
    return true;
  else
    return false;
}
int main(void) {
  cin >> m;
  long long L = 0, R = 1e18;
  while (R > L) {
    long long M = L + (R - L) / 2;
    if (cal(M))
      R = M;
    else
      L = M + 1;
  }
  long long x = R;
  long long ncount = 0;
  for (long long q = 2;; q++) {
    long long q3 = q * q * q;
    if (q3 > x) break;
    ncount += x / q3;
  }
  if (ncount == m)
    cout << x;
  else
    cout << -1;
}
