#include <bits/stdc++.h>
using namespace std;
template <class T1>
T1 GCD(T1 A, T1 B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
template <class T2>
T2 mulmod(T2 a, T2 b) {
  T2 x = 0, y = a % 1000000007;
  while (b) {
    if (b % 2 == 1) {
      x = (x + y) % 1000000007;
    }
    y = (2 * y) % 1000000007;
    b = b / 2;
  }
  return x % 1000000007;
}
template <class T3>
T3 power(T3 a, T3 b) {
  T3 x = 1, y = a % 1000000007;
  while (b) {
    if (b % 2 == 1) {
      x = mulmod(x, y) % 1000000007;
    }
    y = mulmod(y, y) % 1000000007;
    b = b / 2;
  }
  return x % 1000000007;
}
template <class T4>
bool cmp(T4 x, T4 y) {
  return x > y ? 1 : 0;
}
long long int m;
long long int find_ways(long long int vl) {
  long long int ns = 0;
  for (long long int i = 2; i <= 10000000000000000; i++) {
    long long int p = i * i * i;
    if (p > vl) break;
    ns += vl / p;
  }
  return ns;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> m;
  long long int lo = 1, hi = 10000000000000000;
  while (lo < hi) {
    long long int mid = (lo + hi) / 2;
    long long int ways = find_ways(mid);
    if (ways < m)
      lo = mid + 1;
    else if (ways > m)
      hi = mid - 1;
    else
      hi = mid;
  }
  if (find_ways(lo) == m)
    cout << lo;
  else
    cout << "-1";
  return 0;
}
