#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000009;
const long long Max = 1000007;
const double PI = acos(-1.0);
inline long long CUBE(long long x) { return (x * x * x); }
long long wayCount(long long n) {
  long long ret = 0, i;
  for (i = 2; i <= Max; i++) {
    ret += n / CUBE(i);
    if (CUBE(i) > n) break;
  }
  return ret;
}
int main() {
  long long i, j, k, l, temp, t, n, m, caseno = 0, ans;
  string str;
  while (cin >> m) {
    long long low = 0, hi = INF, mid;
    while (low <= hi) {
      mid = (low + hi) / 2;
      temp = wayCount(mid);
      if (temp < m)
        low = mid + 1;
      else
        hi = mid - 1;
    }
    ans = low;
    if (wayCount(ans) != m) ans = -1;
    cout << ans << endl;
  }
  return 0;
}
