#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
long long f(long long x) {
  long long l = 2, r = x;
  while (l < r) {
    long long mid = (l + r) / 2;
    long long t = mid * mid * mid;
    if (t == x)
      return mid;
    else if (t > x)
      r = mid;
    else
      l = mid + 1;
  }
  if (l * l * l <= x)
    return x;
  else
    return l - 1;
}
long long g(long long x) { return x * x * x; }
long long gao(long long x) {
  long long ans = 0, i = 1;
  while (1) {
    ++i;
    long long tmp = i * i * i;
    if (tmp <= x)
      ans += x / tmp;
    else
      break;
  }
  return ans;
}
int main() {
  long long n;
  cin >> n;
  long long l = 1, r = 1e16;
  long long ans = 0;
  while (l < r) {
    long long mid = (l + r) / 2;
    long long ret = gao(mid);
    if (ret >= n)
      r = mid, ans = mid;
    else
      l = mid + 1;
  }
  if (gao(ans) == n)
    cout << ans << endl;
  else
    cout << -1 << endl;
}
