#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7, maxn = 100005, ln = 17;
const int shift = 30, etf = mod - 1, LIM = (int)1e9;
unsigned long long int inf = ((unsigned long long int)1 << 63) - 1;
const double PI = (double)3.141592653589793238, EPSILON = 1e-10;
int main() {
  unsigned long long int m, ans = -1;
  int flag = 0;
  cin >> m;
  unsigned long long int p = 1, q = inf;
  while (p <= q) {
    unsigned long long int mid = (p + q) >> 1, cnt = 0;
    int cr = pow(mid, (1.0 / 3));
    for (int i = 2; i < cr + 2; i++) {
      unsigned long long int mul = i;
      mul *= i;
      mul *= i;
      cnt += mid / mul;
    }
    if (cnt < m) {
      p = mid + 1;
    } else {
      if (cnt == m) flag = 1;
      ans = mid;
      q = mid - 1;
    }
  }
  if (flag)
    cout << ans << endl;
  else
    cout << "-1" << endl;
  return 0;
}
