#include <bits/stdc++.h>
using namespace std;
long long int k;
long long int ways(long long int n) {
  long long int calc, ways = 0;
  for (int k = 2; k <= 10000000; k++) {
    calc = n / (1ll * k * k * k);
    ways += calc;
    if (calc == 0) {
      break;
    }
  }
  return ways;
}
long long int binarysearch(long long int low, long long int high) {
  long long int temp = high;
  while (low <= high) {
    long long int mid = low + (high - low) / 2;
    long long int x = ways(mid);
    if (x > k)
      high = mid - 1;
    else if (x < k)
      low = mid + 1;
    else if (x == k) {
      temp = min(temp, mid);
      high = mid - 1;
    }
  }
  return temp;
}
int main() {
  scanf("%lld", &k);
  long long int MAX = 10 * k;
  long long int ans = binarysearch(8, MAX);
  if (ans == MAX) ans = -1;
  printf("%lld\n", ans);
}
