#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m;
  cin >> m;
  long long value = 0, s = 8, e = 5e15;
  bool flag = 0;
  while (s <= e) {
    long long value = 0;
    long long mid = (s + e) / 2;
    for (long long j = 2; mid / (j * j * j) > 0; ++j)
      value += (mid / (j * j * j));
    if (value == m) {
      long long i = mid;
      while (value == m) {
        i--;
        value = 0;
        for (long long j = 2; i / (j * j * j) > 0; ++j)
          value += (i / (j * j * j));
      }
      cout << i + 1;
      flag = 1;
      break;
    } else if (value > m) {
      e = mid - 1;
    } else
      s = mid + 1;
  }
  if (!flag) cout << "-1";
}
