#include <bits/stdc++.h>
using namespace std;
long long judge(long long mid) {
  long long b;
  long long cnt = 0;
  for (b = 2;; b++) {
    cnt += mid / b / b / b;
    if (mid / b / b / b == 0) break;
  }
  return cnt;
}
int main() {
  long long m;
  cin >> m;
  long long r = 1e16, l = 0;
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (judge(mid) >= m)
      r = mid;
    else
      l = mid;
  }
  if (judge(l) == m)
    cout << l << endl;
  else if (judge(r) == m)
    cout << r << endl;
  else
    cout << "-1" << endl;
  return 0;
}
