#include <bits/stdc++.h>
using namespace std;
long long cal(long long x, long long m) {
  long long tem = 2;
  long long cnt = 0;
  while (1) {
    long long c = tem * tem * tem;
    if (c > x) return cnt;
    cnt += (x / c);
    if (cnt > m) return cnt;
    tem++;
  }
}
int main() {
  long long m;
  while (cin >> m) {
    long long l, r;
    long long ans = -1;
    l = 1, r = 1e16;
    while (l <= r) {
      long long mid = (l + r) / 2;
      long long tmp = cal(mid, m);
      if (tmp >= m) {
        r = mid - 1;
        if (tmp == m) ans = mid;
      } else
        l = mid + 1;
    }
    cout << ans << endl;
  }
  return 0;
}
