#include <bits/stdc++.h>
using namespace std;
long long check(long long mid) {
  long long ans = 0;
  for (long long i = 2;; ++i) {
    ans += (mid / (i * i * i));
    if (i * i * i >= mid) break;
  }
  return ans;
}
int main() {
  long long m;
  cin >> m;
  long long l = 1ll, r = 1e18;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid) < m)
      l = mid + 1;
    else
      r = mid - 1;
  }
  if (check(l) == m)
    cout << l << endl;
  else
    cout << -1 << endl;
  return 0;
}
