#include <bits/stdc++.h>
using namespace std;
ifstream fin("Sisend.txt");
long long n, su;
vector<long long> v;
bool b(long long k) {
  su = 0;
  for (long long j = 0; j <= 1000000; j++) {
    if (v[j] > k) break;
    su += k / v[j];
  }
  if (su >= n) return 1;
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> n;
  for (int(i) = (0); ((i)) < ((200000)); ((i))++)
    if (i > 1) v.emplace_back((long long)i * i * i);
  long long l = 0, r = 10000000000000000;
  long long k;
  while (l < r) {
    k = (l + r) / 2;
    if (!b(k) and !b(k + 1))
      l = k + 1;
    else
      r = k;
  }
  b(l + 1);
  ;
  if (su == n)
    cout << l + 1;
  else
    cout << -1;
}
