#include <bits/stdc++.h>
using namespace std;
long long power(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}
long long data[215445];
long long getcnt(long long n) {
  long long cnt = 0;
  int i = 0;
  while (data[i] <= n) cnt += n / data[i++];
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long value = power(2, 3);
  int j = 3, i = 0;
  while (value <= 1e16) {
    data[i++] = value;
    value = power(j++, 3);
  }
  data[i] = power(10, 16) + 1;
  long long n;
  cin >> n;
  long long low = 0, high = 1e16, mid;
  while (low < high) {
    mid = (low + high) / 2;
    long long cnt = getcnt(mid);
    if (cnt >= n)
      high = mid;
    else
      low = mid + 1;
  }
  if (getcnt(low) == n)
    cout << low << "\n";
  else
    cout << -1 << "\n";
  return 0;
}
