#include <bits/stdc++.h>
using namespace std;
int main() {
  long long M;
  cin >> M;
  long long sx = 1, dx = 5e15;
  long long answ = -1;
  while (sx <= dx) {
    long long mid = (sx + dx) / 2;
    long long comb = 0;
    long long m = ceil(pow(mid, 1.f / 3.f));
    for (long long i = 2; i <= m; i++) comb += (mid / (i * i * i));
    if (comb >= M) {
      dx = mid - 1;
      if (comb == M) answ = mid;
    } else
      sx = mid + 1;
  }
  cout << answ;
  return 0;
}
