#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long m;
  cin >> m;
  long long lo = 1, hi = m * 8;
  long long ans = -1;
  while (lo <= hi) {
    long long mid = (lo + hi) >> 1;
    long long cnt = 0;
    for (long long i = 2; i * i * i <= mid; i++) {
      cnt += (mid / (i * i * i));
    }
    if (cnt >= m) {
      hi = mid - 1;
      if (cnt == m) ans = mid;
    } else
      lo = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
