#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;
long long int ans = 1e18, m;
bool is(long long int mid) {
  long long int ways = 0;
  for (long long int i = 2; i <= 10000000; i++) {
    long long int temp = mid / (i * i * i);
    if (temp == 0)
      break;
    else
      ways += temp;
  }
  if (ways == m) {
    ans = min(ans, mid);
  }
  if (ways < m) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  long long int l = 1, r = 1e18;
  cin >> m;
  while (r - l > 1) {
    long long int mid = (r + l) / 2;
    if (is(mid))
      r = mid;
    else
      l = mid;
  }
  if (ans == 1e18) ans = -1;
  cout << ans;
  return 0;
}
