#include <bits/stdc++.h>
using namespace std;
map<unsigned long long, unsigned long long> mem;
unsigned long long num_ways(unsigned long long n) {
  if (mem.find(n) != mem.end()) return mem[n];
  unsigned long long k = 2;
  unsigned long long ways = 0;
  unsigned long long kcubed = k * k * k;
  while (kcubed <= n) {
    ways += n / kcubed;
    k++;
    kcubed = k * k * k;
  }
  mem[n] = ways;
  return ways;
}
int main() {
  int t = 1;
  unsigned long long n;
  for (int i = 0; i < t; i++) {
    cin >> n;
    unsigned long long low = 0;
    unsigned long long high = 2E20;
    unsigned long long mid = (low + high) / 2;
    while (mid > low) {
      unsigned long long ways = num_ways(mid);
      if (ways < n) {
        low = mid;
      } else if (ways >= n) {
        high = mid;
      }
      mid = (low + high) / 2;
    }
    if (num_ways(high) == n)
      cout << high << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
