#include <bits/stdc++.h>
using namespace std;
long long int get(long long int n) {
  long long int ans = 0;
  for (int i = 2; i * 1LL * i * i <= n; ++i) ans += n / (i * 1LL * i * i);
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int m;
  cin >> m;
  long long int l = 0, r = 1e18;
  while (r - l > 0) {
    long long int mm = (l + r) / 2;
    if (get(mm) < m)
      l = mm + 1;
    else
      r = mm;
  }
  if (get(l) == m)
    cout << l;
  else
    cout << -1;
  return 0;
}
