#include <bits/stdc++.h>
using namespace std;
const int lim = 2 * 1e9 + 100;
long long m, l = 1, r = 1e18, mid = 0, sum = 0;
stack<long long> sk;
int main() {
  cin >> m;
  while (l <= r) {
    sum = 0;
    mid = l + (r - l) / 2;
    for (long long k = 2; k <= mid; k++) {
      if (k * k * k > mid) break;
      sum += mid / (k * k * k);
    }
    if (sum == m) {
      sk.push(mid);
      r = mid - 1;
    } else if (sum > m)
      r = mid - 1;
    else
      l = mid + 1;
  }
  if (sk.empty() == false)
    cout << sk.top();
  else
    cout << -1;
  return 0;
}
