#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long n, m, k;
vector<long long> cubes;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> m;
  n = 7;
  k = 1024LL * 1024 * 1024 * 1024 * 1024 * 6;
  long long a = 2;
  while (1) {
    long long b = a * a * a;
    if (b > k) break;
    cubes.push_back(b);
    a++;
  }
  bool succeed = 0;
  while (n + 1 < k) {
    long long mid = (n + k) / 2;
    long long s = 0;
    for (int i = 0; i < (int)cubes.size(); i++) {
      if (mid < cubes[i] || s > m) break;
      s += mid / cubes[i];
    }
    if (s >= m)
      k = mid;
    else
      n = mid;
    if (s == m) succeed = 1;
  }
  if (!succeed)
    cout << -1 << "\n";
  else
    cout << k << "\n";
  return 0;
}
