#include <bits/stdc++.h>
using namespace std;
long long int kol(long long int m) {
  long long int cnt = 0;
  long long int x = 2;
  while (x * x * x <= m) {
    cnt += m / (x * x * x);
    x++;
  }
  return cnt;
}
int main() {
  long long int k;
  cin >> k;
  long long int l = 8, r = 4e18;
  while (l < r) {
    long long int m = (l + r) / 2ll;
    if (kol(m) < k)
      l = m + 1;
    else
      r = m;
  }
  if (kol(l) == k)
    cout << l << endl;
  else
    cout << -1 << endl;
}
