#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double PI = 4.0 * atan(1.0);
long long m, num, lef, rig, mid, ans, wn;
long long cal(long long n) {
  num = 0;
  for (long long i = 2; i * i * i <= n; i++) {
    num += n / (i * i * i);
  }
  return num;
}
int main() {
  while (~scanf("%I64d", &m)) {
    lef = 0;
    rig = 1e16;
    while (lef <= rig) {
      mid = lef + rig >> 1;
      wn = cal(mid);
      if (wn >= m) {
        ans = wn;
        rig = mid - 1;
      } else
        lef = mid + 1;
    }
    printf("%I64d\n", ans == m ? lef : -1);
  }
}
