#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long m;
  cin >> m;
  long long lo = 0, hi = 1e18;
  long long ans = -1;
  while (hi - lo > 1) {
    long long mid = lo + (hi - lo) / 2;
    long long cnt = 0;
    for (long long i = 2; i * i * i <= mid; ++i) {
      cnt += mid / (i * i * i);
    }
    if (cnt == m) {
      ans = mid;
    }
    if (cnt >= m) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
