#include <bits/stdc++.h>
using namespace std;
long long int f(long long int mid) {
  long long int kk = 2, way = 0;
  while (1) {
    if (kk * kk * kk > mid) break;
    way += mid / (kk * kk * kk);
    kk++;
  }
  return way;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long int m;
  cin >> m;
  long long int lo = 1, hi = 1e18, mid;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    if (f(mid) >= m)
      hi = mid;
    else
      lo = mid + 1;
  }
  if (f(lo) == m)
    cout << lo;
  else
    cout << "-1";
  return 0;
}
