#include <bits/stdc++.h>
using namespace std;
long long check(long long mid) {
  long long answer = 0;
  for (int i = 2; i <= 500000; i++) {
    long long x = mid;
    x /= i;
    x /= i;
    x /= i;
    answer += x;
  }
  return answer;
}
int main() {
  long long n;
  cin >> n;
  long long low = 0;
  long long high = 10000000000000000;
  while (low <= high) {
    long long mid = (low + high) / 2;
    long long lowww = check(mid);
    if (lowww >= n) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  long long start = max(low - 20, 1LL);
  long long end = low + 20;
  int flag = 0;
  for (long long i = start; i <= end; i++) {
    if (check(i) == n) {
      flag = 1;
      cout << i << endl;
      break;
    }
  }
  if (flag == 0) {
    cout << -1 << endl;
  }
}
