#include <bits/stdc++.h>
using namespace std;
const int INF = 2 * int(1e9);
const long long INFll = 1ll * int(1e9) * int(1e9);
const int MOD = 1000000007;
template <typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<pair<T, T> > a) {
  for (int i = 0; i < a.size(); ++i) out << a[i] << endl;
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> a) {
  for (int i = 0; i < a.size(); ++i)
    if (i == a.size() - 1)
      out << a[i];
    else
      out << a[i] << " ";
  return out;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  long long x;
  cin >> x;
  long long l = 1, r = INFll / 10;
  long long ans;
  bool found = 0;
  while (l <= r) {
    long long mid = (l + r) / 2;
    long long k = 0;
    int cur = 2;
    while (1) {
      long long q = 1ll * cur * cur * cur;
      if (q > mid) break;
      k += mid / q;
      cur++;
    }
    if (k == x) found = 1;
    if (k >= x)
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  if (!found)
    cout << -1;
  else
    cout << ans << endl;
  if (0)
    cerr << fixed << setprecision(0)
         << "TIME = " << clock() / (long double)CLOCKS_PER_SEC * 1000 << "\n";
  return 0;
}
