#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const long long inf = 1e17;
const int mod = 1e9 + 7;
long long coun(long long now) {
  long long count = 0;
  for (int i = 2;; i++) {
    long long cube = 1ll * i * i * i;
    if (cube > now)
      break;
    else
      count += (now / cube);
  }
  return count;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long k;
  cin >> k;
  long long l = 1, r = inf;
  while (r - l > 1) {
    long long m = (r + l) >> 1;
    long long count = coun(m);
    if (count >= k)
      r = m;
    else
      l = m;
  }
  if (coun(r) == k)
    cout << r << endl;
  else
    cout << -1 << endl;
}
