#include <bits/stdc++.h>
using namespace std;
long long eval(long long val) {
  long long ans = 0;
  long long croot = pow(val, 1.0 / 3.0);
  if ((croot + 1) * (croot + 1) * (croot + 1) == val) croot++;
  for (long long i = 2; i <= croot; i++) {
    ans += val / (i * i * i);
  }
  return ans;
}
int main() {
  long long m;
  cin >> m;
  long long start = 1, last = pow(10, 16);
  long long ans = -1;
  while (start <= last) {
    long long mid = (start + last) / 2;
    if (eval(mid) == m) {
      ans = mid;
      last = mid - 1;
    } else if (eval(mid) < m) {
      start = mid + 1;
    } else {
      last = mid - 1;
    }
  }
  if (eval(ans) == m)
    cout << ans;
  else
    cout << -1;
}
