#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long cnt(long long x) {
  long long ans = 0;
  for (int i = 0; i < a.size(); ++i) ans += x / a[i];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  for (long long i = 2; i <= 200000; ++i) a.push_back(i * i * i);
  long long l = 1;
  long long r = (4ll) * (1000000000ll) * (1000000000ll);
  long long m;
  cin >> m;
  while (r - l > 1) {
    long long mm = (r + l) / 2;
    if (cnt(mm) < m)
      l = mm;
    else
      r = mm;
  }
  if (cnt(l) == m)
    cout << l;
  else if (cnt(r) == m)
    cout << r;
  else
    cout << -1;
  return 0;
}
