#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i;
  long long req;
  cin >> req;
  long long bot = 1;
  long long top = 9017199254740992;
  while (top - bot > 1) {
    long long mid = (bot + top) / 2;
    long long i = 2;
    long long ans = 0;
    bool flag = 0;
    long long hh = 8;
    while (hh <= mid) {
      ans += mid / hh;
      ++i;
      hh = i * i * i;
      if (ans >= req) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      top = mid;
    } else
      bot = mid;
  }
  long long mid = bot;
  i = 2;
  long long ans = 0;
  long long hh = 8;
  while (hh > 0 && hh <= mid) {
    ans += mid / hh;
    ++i;
    hh = i * i * i;
  }
  if (ans != req) {
    long long mid = top;
    i = 2;
    long long ans = 0;
    long long hh = 8;
    while (hh > 0 && hh <= mid) {
      ans += mid / hh;
      ++i;
      hh = i * i * i;
    }
    if (ans != req)
      printf("-1\n");
    else
      cout << top << "\n";
  } else
    cout << bot << "\n";
}
