#include <bits/stdc++.h>
using namespace std;
long long get_cnt(long long n) {
  long long rest = 0;
  long long k = 2;
  while (true) {
    long long tmp = k * k * k;
    if (tmp > n) break;
    rest += n / tmp;
    k++;
  }
  return rest;
}
bool check(long long n, long long m) {
  long long rest = get_cnt(n);
  if (rest >= m) return true;
  return false;
}
int main() {
  ifstream fin;
  ofstream fout;
  fin.open("input.txt");
  fout.open("output.txt");
  long long m;
  cin >> m;
  long long l = 1;
  long long r = 1000000000;
  r *= r;
  long long rest = 0;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid, m)) {
      r = mid;
      rest = mid;
    } else
      l = mid + 1;
  }
  long long cnt = get_cnt(rest);
  if (cnt != m) {
    cout << -1;
  } else {
    cout << rest;
  }
  fin.close();
  fout.close();
  return 0;
}
