#include <bits/stdc++.h>
using namespace std;
long long m, a, b;
int check(long long a, long long b) {
  long long ct = 0, k = 2;
  while (a >= k * k * k) {
    ct += (a / (k * k * k));
    k++;
  }
  if (ct < b)
    return 0;
  else if (ct > b)
    return 1;
  else
    return 2;
}
int main() {
  cin >> m;
  long long lo = 0, hi = 1000000000000000007, mid;
  while (lo < hi) {
    mid = lo + (hi - lo) / 2;
    if (check(mid, m) == 0) {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  if (check(lo, m) == 2)
    cout << lo << "\n";
  else
    cout << "-1\n";
}
