#include <bits/stdc++.h>
using namespace std;
const int N = 1000006;
long long arr[N];
int main() {
  long long i, m, lef, rig, mid, t;
  bool f;
  for (i = 2; i < N; i++) arr[i] = i * i * i;
  while (scanf("%I64d", &m) != EOF) {
    lef = 0;
    rig = 1e18;
    while (rig - lef > 1) {
      mid = lef + ((rig - lef) >> 1);
      t = 0;
      f = 1;
      for (i = 2; arr[i] <= mid; i++) {
        t += (mid / arr[i]);
        if (t >= m) {
          f = 0;
          rig = mid;
          break;
        }
      }
      if (f) lef = mid;
    }
    t = 0;
    for (i = 2; arr[i] <= rig; i++) t += (rig / arr[i]);
    if (t != m) rig = -1;
    printf("%I64d\n", rig);
  }
  return 0;
}
