#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n;
long long check(long long n) {
  long long cnt = 0;
  for (long long k = 2; k * k * k <= n; k++) {
    cnt += n / (k * k * k);
  }
  return cnt;
}
int main() {
  long long m, ans = -1, l = 1, r = 1e16, mid;
  cin >> m;
  while (l <= r) {
    mid = (l + r) / 2;
    long long num = check(mid);
    if (num == m) ans = mid;
    if (num >= m)
      r = mid - 1;
    else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
