#include<bits/stdc++.h>
using namespace std;
#define re register
#define gcd __gcd
#define ft first
#define sd second
#define mr make_pair
#define lowbit(x) ((x)&-(x))
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> pii;
const int N = 2e6+7;
const int M = 2e6+7;
const int lim = 1e6;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
LL fun(LL x)
{
	LL ans = 0;
	for(re LL i=2;i*i*i<=x;i++)
		ans += x/(i*i*i);
	return ans;
}
int main()
{
	LL l=0,r=1e16,mid,n,ans=-1;
	scanf("%lld",&n);
	while( l <= r )
	{
		mid = (l+r)>>1;
		if( fun(mid) >= n )
			r = mid-1,	ans = mid;
		else
			l = mid+1;
	}
	printf("%lld\n",fun(ans)==n?ans:-1);
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll get(ll n)
{
	ll ans = 0;
	for(ll i = 2; (i*i*i) <= n; i++)
	{
		ans += n/(1ll*i*i*i);
	}
	return ans;
}
int main()
{
	ll m;
	cin >> m;
	ll low = 0, high = 2e18;
	while(low < high)
	{
	    ll mid = (low+high)/2;
		if(get(mid) < m)
		low = mid+1;
		else if(get(mid) >= m)
		high = mid;
	}
	if(get(high) == m)
	cout << high << '\n';
	else
	cout << "-1" << '\n';
	return 0;
}

#include <iostream>

using namespace std;

long long M;

long long find_number(long long N){
  long long counter = 0;
  for(long long i=2;i<N;i++){
      if(N / (i*i*i) == 0)
        break;
      counter += N / (i*i*i);
  }
  return counter;
}

int main(){
  cin >> M;
  long long first = 1, last = 1000000000000000009;
  while(first +1 < last){
      long long middle = (first+last) / 2;
      long long ctr = find_number(middle) ;
      if(ctr >= M)
        last = middle;
      else
        first = middle;
  }  if(find_number(first) == M)
    cout << first << endl;
  else if(find_number(last) == M)
    cout << last << endl;
  else
    cout << -1 << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define DEBUG

#ifdef DEBUG
    #define debug(...) printf(__VA_ARGS__)
#else
    #define debug(...) (void)0
#endif
#define mp make_pair
#define pb push_back
#define LL long long
#define pii pair<int,int>
#define PII pair<long long, long long>
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
const int inf = 0x7fffffff; //beware overflow
const LL  INF = 0x7fffffffffffffff; //beware overflow
const LL mod = 1e9+7;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) {
     return s<<"("<<p.first<<","<<p.second<<")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
    s << "[ ";
    for (auto it : c) s << it << " ";
    s << "]";
    return s;
}
template<typename T>
ostream& operator << (ostream &o, const set<T> &st) {
    o << "{";
    for (auto it=st.begin(); it!=st.end(); it++) o << (it==st.begin() ? "" : ", ") << *it;
    return o << "}";
}
template<typename T1, typename T2>
ostream& operator << (ostream &o, const map<T1, T2> &mp) {
    o << "{";
    for (auto it=mp.begin(); it!=mp.end(); it++) {
        o << (it==mp.begin()?"":", ") << it->fi << ":" << it->se;
    }
    o << "}";
    return o;
}
#define maxn 100001
LL  calc[maxn], m;
LL cubic[maxn];

LL cnt(LL c) {
    LL ret = 0;
    LL t;
    for(int i = 2; (t=1ll*i*i*i) <= c; i ++)
        ret += c/t;
    return ret;
}
int main() {
    cin>>m;
    memset(calc, 0, sizeof(calc));
    LL ub = 1ll<<62, lb = -1;
    while( ub-lb > 1) {
        //cout << ub << " " << lb << endl;
        LL mid = (ub+lb)>>1;
        if( cnt(mid) >= m) ub = mid;
        else lb = mid;
    }
    if( cnt(ub) != m) cout << "-1" << endl;
    else cout << ub <<endl;
}

#include <bits/stdc++.h>
using namespace std;

#define DEBUG

#ifdef DEBUG
    #define debug(...) printf(__VA_ARGS__)
#else
    #define debug(...) (void)0
#endif
#define mp make_pair
#define pb push_back
#define LL long long
#define pii pair<int,int>
#define PII pair<long long, long long>
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
const int inf = 0x7fffffff; //beware overflow
const LL  INF = 0x7fffffffffffffff; //beware overflow
const LL mod = 1e9+7;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) {
     return s<<"("<<p.first<<","<<p.second<<")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
    s << "[ ";
    for (auto it : c) s << it << " ";
    s << "]";
    return s;
}
template<typename T>
ostream& operator << (ostream &o, const set<T> &st) {
    o << "{";
    for (auto it=st.begin(); it!=st.end(); it++) o << (it==st.begin() ? "" : ", ") << *it;
    return o << "}";
}
template<typename T1, typename T2>
ostream& operator << (ostream &o, const map<T1, T2> &mp) {
    o << "{";
    for (auto it=mp.begin(); it!=mp.end(); it++) {
        o << (it==mp.begin()?"":", ") << it->fi << ":" << it->se;
    }
    o << "}";
    return o;
}
#define maxn 100001
LL  calc[maxn], m;
LL cubic[maxn];

LL cnt(LL c) {
    LL ret = 0;
    LL t;
    for(int i = 2; (t=1ll*i*i*i) <= c; i ++)
        ret += c/t;
    return ret;
}
int main() {
    cin>>m;
    memset(calc, 0, sizeof(calc));
    LL ub = 1e16, lb = -1;
    while( ub-lb > 1) {
        //cout << ub << " " << lb << endl;
        LL mid = (ub+lb)>>1;
        if( cnt(mid) >= m) ub = mid;
        else lb = mid;
    }
    if( cnt(ub) != m) cout << "-1" << endl;
    else cout << ub <<endl;
}

#include <bits/stdc++.h>
#include <dirent.h>
//#include "rubo.h"

#define dbl double
#define pb push_back
#define SQ(x) (x)*(x)
#define ll long long
#define vc vector
#define F first
#define S second
#define in ll
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(x) x.begin(), x.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt...) (0)

using namespace std;

const int MAXN = 100005;

ll m;

ll ways(ll n){
    ll res = 0;
    for(ll k = 2; k*k*k <= n; k++){
        ll k3 = k*k*k;
        res += n/k3;
    }
    return res;
}

int main() {
    cin >> m;
    ll l = 8, r = 1e18,mid;
    while(l < r){
        mid = (l+r)/2;
//        printf("l r mid %lld %lld %lld\n",l,r,mid);
        if(ways(mid) >= m){
            r = mid;
        }
        else{
            l = mid+1;
        }
    }

    if(ways(r) == m){
        cout << r;
    }
    else{
        cout << -1;
    }
    return 0;
}

//This is getting accepted!
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}

 ll m;
int main() {
#ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif

	cin >> m;
	ll l = 1, r = 10000000000000000L;
	ll ans = -1;
	while (l <= r) {
		ll mid = (l + r) / 2ll;
		ll ret = 0ll;
		for (ll i=2; i * i * i <=mid; i++) {
			ll tmp = (ll) i * i * i;
			if (tmp > mid) break;
			ret += mid / tmp;
		}
		if (ret == m) {
			ans = mid;
		}
		if (ret < m) l = mid + 1;
		else r = mid - 1;
	}

	cout << ans;
}

#include <math.h>
#include <stdlib.h>

#include <iostream>
using namespace std;

typedef long double ld;
typedef long long ll;

ll count_ways (ll num) {
    ll A, acc = 0;
    int maxR = powl(num, 1/3.L);

    for ( int r = 2; r <= maxR; ++r )
    {
        A = num / powl(r,3);
        acc += A;
    }

    return acc;
}

ll bin_search (ll n) {
    ll max = 4949100894494448;
    ll min = 8;

    ll mid = (max + min) / 2;
    while (mid != min)
    {
        ll ways = count_ways(mid);

        if (ways >= n)
            max = mid;
        else
            min = mid;

        mid = (max + min) / 2;
    }

    if (count_ways(min) == n)
        return min;
    else if (count_ways(max) == n)
        return max;

    return -1;
}

int main () {
    ll num;

    cin >> num;
    cout << bin_search(num) << endl;

    return 0;
}
// 1493932624037

#include<bits\stdc++.h>
using namespace std;
#define LL long long
int main(int argc, char const *argv[]){
    LL m;
    LL ans, minans = -1;
    LL l=1, r=(2LL<<60);
    cin>>m;
	while(l <= r) {
        LL mid = (l+r) / 2;
        ans = 0;
        for(LL k=2; k*k*k<=mid; k++) {
            ans += mid / (k*k*k);
        }

        if(ans==m) minans = mid;
        if(ans >= m) r = mid - 1;
        else l = mid + 1;
    }
	printf("%I64d\n", minans);

	return 0;
}

#include<stdio.h>
#include<string.h>
#include<map>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#define MAX 1000006
#define MOD 1000000009
using namespace std;
const double PI=acos(-1);

long long cal(long long x)
{
    int j;
    long long sum=0,n,i;
    for(i=2;1;i++)
    {
        n=i*i*i;
        if(n>x)
            break;
        sum+=x/n;
    }
    return sum;
}
int main()
{
    int x,y,i,j,k,m,cas,s,sum,b,ans;
    long long n,r,l,mid,t;
    while(scanf("%I64d",&n)!=EOF)
    {
        l=7;
        r=(long long)1e16+7;
        while(l+1<r)
        {
            mid=(l+r)/2;
            t=cal(mid);
            if(t<n)
            {
                l=mid;
            }
            else
            {
                r=mid;
            }
        }
        if(cal(r)==n)
        {
            printf("%I64d\n",r);
        }
        else
        {
            printf("-1\n");
        }
    }
    return 0;
}
/*2016-11-13 08:06:26.794*/

#include<bits/stdc++.h>
using namespace std;

long long check(long long n)
{
    long long sum=0;
    for(long long i=2; (i*i*i)<=n; i++)
        sum+=n/(i*i*i);
    return sum;
}
int main()
{
    long long n;
    scanf("%I64d",&n);
    long long l=1,r=1e18,m;
    while(l<r)
    {
        m=(l+r)/2;
        if(check(m)>=n)
            r=m;
        else
            l=m+1;
    }
    if(check(r)==n)
        printf("%I64d\n",r);
    else printf("-1\n");
}
/*2017-08-10 15:12:07.938*/

#include <bits/stdc++.h>
using namespace std;
long long pow1(long long k,long long i)
{
	long long ans=1;
	for(long long j=1;j<=i;j++)
		ans*=k;
	return ans;
}
int main() {
	long long m;
	cin>>m;
	long long lo=8,hi=8*pow1(10,15);
	while(lo<hi)
	{
		long long mid=lo+(hi-lo)/2;
		long long k=2,i=3,ans=0,cub=pow1(k,i);
		while(cub<=mid)
		{
			ans+=(mid/cub);
			k++;
			cub=pow1(k,i);
		}
		if(ans>=m)
			hi=mid;
		else
			lo=mid+1;
	}
	long long k=2,i=3,ans=0,cub=pow1(k,i);
	while(cub<=hi)
	{
		ans+=(hi/cub);
		k++;
		cub=pow1(k,i);
	}
	if(ans==m)
		cout<<hi<<endl;
	else
		cout<<"-1"<<endl;

}

#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>
#include<set>
#include<time.h>
using namespace std;

	long long i,j,s,k,l,r,l1,r1,m,n,a[1000001]={0},b[1000001]={0};
int main(){
	cin>>m;
	l=1;
	for(i=1;i<=1000000;i++)
		a[i]=i*i*i;
	r=1000000000000000000;
	while(l<r){
		n=l+(r-l)/2;
		s=0;
		k=0;
		for(i=2;i<=500000;i++){
			s=s+n/a[i];
			if(n%a[i]==0){
				k++;
				r1=i;}}
		if(s>m || (s==m && k==0))
			r=n-1;
		else if(s<m)
			l=n+1;
		else {
			cout<<n;return 0;}}
	n=l;
	s=0;
		k=0;
		for(i=2;i<=500000;i++){
			s=s+n/a[i];
			if(n%a[i]==0){
				k++;
				r1=i;}}
		if(s!=m)
			cout<<-1;
		else {
			cout<<n;}
	//system("pause");
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define MAX 1000000000000000000ll
#define N 1000000

long long pot[N + 1];

long long check(long long n){
	long long ans = 0;
	int k;

	for (k = N; k > 1; k--){
		ans += n / pot[k];
	}

	return ans;
}

int main(){
	long long left, right, mid, m, i;

	scanf("%lld", &m);

	for (i = 1; i <= N; i++){
		pot[i] = i * i * i;
	}

	left = 1;
	right = MAX;

	while (left < right){
		mid = (left + right) / 2;

		if (check(mid) >= m){
			right = mid;
		}
		else{
			left = mid + 1;
		}
	}

	if (check(left) == m){
		printf("%lld\n", left);
	}
	else{
		printf("-1\n");
	}

	return 0;
}
// 1493933969462

#include<bits/stdc++.h>
#define int long long int
using namespace std;
main(){
    int m;cin>>m;
    int l=0,r=1e18;
    while(r-l>1){
     int md=(r+l)/2;
     int mm=0;
     for(int i=0;i<200000;i++){
          int k=(i+2)*(i+2)*(i+2);
          mm+=md/k;
     }
     if(mm>=m)r=md;
     else l=md;
    }
     int mk=0;
     for(int i=0;i<200000;i++){
          int k=(i+2)*(i+2)*(i+2);
          mk+=r/k;
     }
     if(mk==m)
    cout<<r;
else cout<<-1;
}

#include<stdio.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
typedef long long ll;
ll cal(ll i)
{
     long long k,ans=0;
     for(k=2;k*k*k<=i;k++)

            ans+=i/(k*k*k);

     return ans;

}
ll binary_search(ll n)
{
    ll i,l=1,r=1e18,mid;
    while(l<r)
    {
        mid=(r+l)/2;
        if(cal(mid)>=n)
           r=mid; r-mid;
        if(cal(mid)==n)
            r=mid;

        if(cal(mid)<n) l=mid+1;

    }

    if(cal(l)!=n) return -1;
    return l;
}

int main()
{
    ll n;
    while(~scanf("%I64d",&n))
    {

        ll cnt=binary_search(n);
        printf("%I64d\n",cnt);
    }
   return 0;

}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll berch(ll n){
    ll lo = 1, mid, moo;
    ll hi = 100000000000000099;
    while(lo <= hi){
        mid = lo + (hi - lo)/2;

        ll sum = 0;
        for(ll i = 2; i <= sqrt(mid); i++){
            moo = mid/(i*i*i);
            if(moo == 0){
                break;
            }
            else{
                sum += moo;
            }
        }
        if(sum >= n){
            hi = mid;
        }
        else if(sum < n){
            lo = mid + 1;
        }
        if(lo == hi){
            break;
        }
    }
    return lo;
}
int main() {
    ll n;
    cin>>n;
    ll boi;
    ll maus = 0;
    boi = berch(n);
    ll mooo;
    for(ll i = 2; i <= sqrt(boi); i++){
            mooo = boi/(i*i*i);
            if(mooo == 0){
                break;
            }
            else{
                maus += mooo;
            }
        }
        if(maus != n){
            cout<<-1;
        }
        else{
            cout<<boi;
        }
	return 0;
}

#include<bits/stdc++.h>
#define ld long int
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define INF 1e18
#define vv vector< pair<ld ,ld> >
#define vi vector<ld>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

ll cube[10000010];

ll f(ll n)
{
	ll ans=0;
	for(ll i=2; cube[i]<=n;i++)
	{
		ans+=(n/cube[i]);
	}
	return ans;
}

int main() {
	ll m,l,r,mid,tmp,i;
	cin>>m;

	for(i=2;i<=10000009;i++)
	{
		cube[i]=i*i*i;
	}

	l=-1;
	r=(ll)(pow(10,17))+1;

	f(m);

	while((r-l)>1)
	{
		mid=(l+r)/2;
		tmp=f(mid);
	   if(tmp<m)
		 l=mid;
		else
		 r=mid;

				//cout<<l<<' '<<r<<' '<<mid<<'\n';
    }

   if(f(l)==m)
    cout<<l;
   else if(tmp==m)
      cout<<mid;
   else if(f(r)==m)
      cout<<r;
   else
      cout<<-1;

	// your code goes here
	return 0;
}

#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;
ll n;

bool ch(ll  m){
    unsigned ll t = 0;
    for(ll i=2 ; i<=2*1e5; i++){
        unsigned ll r= i*i*i;
        if(r > m)
            break;
        t += (m/r + 0.00000001);
        if(t >= n)return 1;
    }

    return t >= n;
}
bool ch2(ll  m){
    ll t = 0;
    for(ll i=2 ; i<=2*1e5 ; i++){
        ll r= i*i*i;
        if(r > m)
            break;
        t += (m/r + 0.00000001) ;
        if(t > n)
            return 0;
    }

    return t == n;
}

ll bin(){
    ll res = -1;
    ll l = 1,h = 1e18;
    while(l <= h){
        ll m = (l+h)/2;
        if(ch(m)){
            res = m;
            h = m-1;
        }
        else{
            l = m+1;
        }
    }
    return res;
}

int main(){
    ios::sync_with_stdio(0);
    cin>>n;
    ll res = bin();
    if(res != -1 && ch2(res)){
        cout<<res;
    }
    else{
        cout<<-1;
    }
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <math.h>
#include <stack>

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define endl "\n"
#define mp make_pair
#define pll pair<ll,ll>

/*
#include <fstream>
ifstream in("input.txt");
ofstream out("output.txt");

#define cin in
#define cout out
/**/

vector<ll> a;

ll cnt(ll x)
{
	ll ans = 0;
	for (int i = 0; i <a.size(); ++i)
		ans += x / a[i];
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0);

	for (ll i = 2; i <= 200000; ++i)
		a.push_back(i * i * i);

	ll l = 1;
	ll r = (4ll) * (1000000000ll) * (1000000000ll);

	ll m;
	cin >> m;
	while (r - l > 1)
	{
		ll mm  = (r + l) / 2;

		if (cnt(mm) < m)
			l = mm;
		else
			r = mm;
	}

	if (cnt(l) == m)
		cout << l;
	else if (cnt(r) == m)
		cout << r;
	else
		cout << -1;

	return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
#define int long long
	long long i;
	long long req;
	cin >> req;
	long long bot = 1;
	long long top = 9017199254740992;
	while(top - bot>1)
	{
		long long mid = (bot + top) / 2;
		long long i = 2;
		long long ans = 0;
		bool flag = 0;
		long long hh = 8;
		while(hh <= mid)
		{
			ans += mid / hh;
			++i;
			hh = i*i*i;
			if(ans >= req)
			{
				flag = 1;
				break;
			}
		}
		if(flag)
		{
			top = mid;
		}
		else
			bot = mid;
	}
	long long mid = bot;
	i = 2;
	long long ans = 0;
	int hh = 8;
	while(hh > 0 && hh <= mid)
	{
		ans += mid / hh;
		++i;
		hh = i*i*i;
	}
	if(ans != req)
	{
		long long mid = top;
		i = 2;
		long long ans = 0;
		int hh = 8;
		while(hh > 0 && hh <= mid)
		{
			ans += mid / hh;
			++i;
			hh = i*i*i;
		}
		if(ans != req)
			printf("-1\n");
		else
			cout << top << "\n";
	}
	else
		cout << bot << "\n";
}

#include <vector>
#include <iostream>
#include <map>
#define ll long long
#define INF 2000000000
using namespace std;

ll p3(ll x){
	return x * x * x;
}

ll getAns(ll n){
	ll ans = 0;
	for(ll i = 2; p3(i) <= n; i++){
		ans += (ll)(n / p3(i));
	}
	return ans;
}

ll bin_search(ll M){
	ll l = 1, r = 8 * M;
	while(r - l > 1){
		ll m = (l + r) / 2;
		ll v = getAns(m);
		if(v < M) l = m;
		else r = m;
	}
	if(getAns(r) == M)return r;
	return -1;
}

int main (){
	//freopen("test.txt", "r", stdin);
	ll n;
	cin >> n;
	cout << bin_search(n);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long int

#define pi 2*acos(0.0)
#define mod 1000000007

#define fast   ios_base::sync_with_stdio(false);cin.tie(NULL);

#define pii pair<ll,ll>

#define pb push_back

#define Bit_off(val,pos)       (val & (~(1<<pos)))
#define Bit_on(val,pos)        (val | (1<<pos))
#define Bit_toggle(val,pos)    (val ^ (1<<pos))
#define Bit_check(val,pos)     (bool)(val & (1<<pos))
#define odd_even(val)          (bool)(val & 1)
#define koita_1_ase(val)       (__builtin_popcount(val))

//ll Big_Mod(ll v1, ll p, ll md)  { ll res=1; v1=v1%md; while (p > 0){if (p & 1)res = (res * v1) % md; p =p>>1; v1 = (v1 * v1) % md;}return res;}
ll ar[500009],cr[500009],br[500009],tr[500009];
ll fx[]= {-1,1,0,0};
ll fy[]= {0,0,1,-1};

map<ll,ll>mp;
vector<ll>v[500009];
string s,q,r;

struct evan
{
    ll l,r,w;

} st[500009];
bool com(evan a,evan b)
{
    return a.l<b.l;
}
ll fun(ll a)
{
    ll lo=1,hi=1e18,mid,x,y=1e18,z=0;

    while(lo<=hi)
    {
        mid=(lo+hi)/2;
        x=0;
        for(ll i=2;i*i*i<=mid;i++)
        {
            x+=(mid/(1ll*i*i*i));
        }
        if(x<a)
        {
            lo=mid+1;
        }
        else
        {
            if(x==a)
            {
                z=1;
                y=mid;
            }
            hi=mid-1;
        }
    }
    if(z)
    {
        return y;
    }
    else
    return -1;
}
int main()
{
    ll a,b,c,d,e,i,j,k,x,y,z,f,g,h,n,m;
    cin>>a;
    cout<<fun(a);
}

#include <bits/stdc++.h>
#define oo 1e18
using namespace std;
typedef long long ll;
ll m;
ll cal(ll n)
{
    ll kq=0;
    for(ll i=2;i*i*i<=n;i++)
    kq+=n/(i*i*i);
    return kq;
}
ll res()
{
    ll d=1,c=oo,g;
    while(d<c)
    {
        g=(d+c)/2;
        if(cal(g)>=m) c=g;
        else d=g+1;
    }
    return cal(d)==m?d:-1;
}
int main()
{
    cin>>m;
    cout<<res();
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll ways(ll n)//ways
{
	ll sum = 0;
	for (ll k = 2; k*k*k <= n ; k++)
	{
		sum+=(n/(k*k*k));
	}
	return sum;
}
int main(int argc, char const *argv[])
{
	ll m;
	cin>>m;
	ll l=0,h=1e17;
	while(l<h)
	{
		ll mid = (l+h)/2;
		if ( ways(mid) < m)
			l = mid+1;
		else//ways(mid) >= m
			h = mid;
	}
	if ( ways(h)==m )
		cout<<l<<endl;
	else
		cout<<"-1\n";
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test int t; cin>>t; while(t--)
#define ll long long
#define pll pair<ll,ll>
#define vi vector<ll>
#define pb push_back
#define F first
#define S second
#define I insert
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
const int N = 1e6 + 7;

int main()
{
	bolt;
	ll sum =0 , m , lo = 1 , hi = 1e18 , mid = 0;
	cin >> m;
	ll ans = 0;
	while(lo <= hi){
		mid = (lo+hi)/2;
		sum = 0;
		for(ll k = 2; k*k*k <= mid; k++){
			sum += mid/(k*k*k);
		}
		if(sum >= m)
		{	ans = mid;
			hi = mid-1;
		}
		else if(sum < m)
			lo = mid + 1;
	}

	// cout << mid << " "<<lo<<"\n";
	// cout << ans <<"@\n";

	sum = 0;
	for(ll k = 2; k*k*k <= ans; k++){
			sum += ans/(k*k*k);
		}
	if(sum != m)
		cout << "-1\n";
	else
		cout << ans <<"\n";
}

#define fi freopen("../../../../../Desktop/input.txt", "r", stdin);
#define fo freopen("../../../../../Desktop/output.txt", "w", stdout)
#define fio fi fo
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
#define   max(a,b)     (a>b?a:b)
#define   min(a,b)     (a>b?b:a)
#define INF 99999999
typedef long long int ll;

ll ways(ll n) {
	ll ans = 0;
	for (ll k = 2; k*k*k <= n; k++)ans += n / (k*k*k);

	return ans;
}

int main()
{
	//fio;

	ll m;  cin >> m;

	ll l = 1, r = 5e15 ;

	while (l < r) {

		ll mid = (l + r) / 2;

		if (ways(mid) < m)l = mid+1;
		else r = mid;

	}

	if (ways(l) == m)cout << l;
	else cout << -1;

	return 0;
}

#include<iostream>
#include<algorithm>

using namespace std;

int const N = 2e5 + 41;
long long const INF = (1e9) * 1LL * (1e9);

long long m, n, l, r;

long long get(long long n){
	long long ret = 0;
	for(long long k=2;k*k*k<=n;++k){
		ret += n / (k * k * k);
		if(ret > m){
			return m + 1;
		}
	}
	return ret;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	scanf("%I64d",&m);
	l = 0;
	r = INF;
	while(r-l>1){
		long long mid = (l+r)/2;
		if(get(mid) >= m){
			r = mid;
		}else{
			l = mid;
		}
	}
	if(get(r) == m){
		printf("%I64d\n",r);
	}else{
		printf("-1\n");
	}

	return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <bitset>

#define mod 1000000007
#define lli long long int
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair

#define pii pair<int, int>
#define pll pair<lli, lli>
#define pic pair<int, char>

using namespace std;

lli cubeArray[320200];
lli findmfromn(lli n)
{
	lli ans=0;
	for (int i = 2; i < 320200; ++i)
	{
		ans+=(lli)(n/cubeArray[i]);
	}
	return ans;
}
int main()
{
	ios::sync_with_stdio(false);
	lli m;
	cin>>m;
	for (lli i = 0; i < 320200; ++i)
	{
	 	cubeArray[i]=i*i*i;
	}
	lli lo=1,hi=1e16,ans=-1;
	while(lo<=hi)
	{
		lli mid=(lo+hi)/2;
		lli temp=findmfromn(mid);
		if(temp==m)
		{
			ans=mid;
			hi=mid-1;
		}
		else if(temp<m)
			lo=mid+1;

		else
			hi=mid-1;
	}

	cout<<ans<<endl;

	return 0;
}

#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <random>
#include <stdio.h>
#include <string>
#include <vector>

#define SZ(x) (int)(x.size())
#define F0(i,n) for(int i=0;i<n;i++)
#define F1(i,n) for(int i=1;i<=n;i++)
#define FI(i,n) for(int i=0;i<=n;i++)
#define TR(x) cout << #x << " = " << x << endl
#define FE(k) get<0>(k)
#define SE(k) get<1>(k)
#define TH(k) get<2>(k)
#define TRAV(a, x) for(auto &a: x)
#define _ << " " <<
#define INF 1E9
#define INF64 1E18

using namespace std;

template<class T1, class T2> void pr(const pair<T1,T2>& x);
template<class T, size_t SZ> void pr(const array<T,SZ>& x);
template<class T> void pr(const vector<T>& x);
template<class T> void pr(const set<T>& x);
template<class T1, class T2> void pr(const map<T1,T2>& x);
template<class T> void pr(const T& x) { cout << x; }
template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
  pr(first); pr(rest...);
}
template<class T1, class T2> void pr(const pair<T1,T2>& x) {
  pr("{",x.first,", ",x.second,"}");
}
template<class T> void prContain(const T& x) {
  pr("{");bool fst = 1; TRAV(a,x) pr(!fst?", ":"",a), fst = 0;pr("}");
}
template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
template<class T> void pr(const vector<T>& x) { prContain(x); }
template<class T> void pr(const set<T>& x) { prContain(x); }
template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

void ps() { pr("\n"); }
template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
  pr(first," "); ps(rest...); // print w/ spaces
}

template<typename T> int remin(T& a,const T& b){if(b<a){a=b;return true;}return false;}
template<typename T> int remax(T& a,const T& b){if(b>a){a=b;return true;}return false;}

typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

ll M;
vii v;
bool ok = true;

ll ways(ll n) {
  ll total = 0;
  for (ll k = 2; k * k * k <= n; ++k) {
    total += n / (k * k * k);
  }
  // ps(n, total);
  return total;
}

ll binary_search(ll start, ll end) {
  while (end - start > 1) {
    ll mid = (start + end) / 2;
    if (ways(mid) < M) {
      start = mid;
    } else {
      end = mid;
    }
  }
  return end;
}

int main(int argc, const char **argv) {
  scanf("%lld", &M);
  ll m = binary_search(0, 1000000000000000000);
  ps((ways(m) == M) ? m:  -1);
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

 ll m;

ll check(ll x){
    ll res = 0;
    for(ll i = 2;i * i * i<=x;i++){
        ll l = 0,r = LONG_LONG_MAX,res2 = 0,mid;

        res2 = x /(i * i * i);
        if(res2 == 0)break;
        res += res2;
    }
    return res;
}

int main(){
    cin>>m;
    ll l = 1,r = LONG_LONG_MAX,res,mid;
    bool ok = 0;
    while(r>=l){
        mid = (r+l)/2;
        if(check(mid) >= m){
            r = mid - 1;
            if(check(mid) == m){
                res = mid;
                ok = 1;
            }
        }else{
            l = mid + 1;
        }
    }
    if(ok)
        cout<<res<<endl;
    else
        cout<<-1<<endl;
}

#include <iostream>
#include <math.h>

using namespace std;

typedef long long ll;

ll get(ll n)
{
    ll ans = 0;
    for (ll i = 2; i*i*i <= n; ++i)
    {
        ans += n / (i*i*i);
    }
    return ans;
}

int main()
{
    ll m, n = -1;
    cin >> m;

    ll l = 0, r = 8e15;

    while (l < r)
    {
        ll mid = (l + r)  / 2;
        if (get(mid) < m)
            l = mid + 1;
        else
            r = mid;
    }

    if (get(l) == m)
        n = l;

    cout << n;

    return 0;
}

#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
using namespace std;
typedef long long int ll;
ll m;
ll lef, rig, mid, best;
int ok;
ll func(ll x)
{
	ll i, cnt=0;
	for(i=2 ; i*i*i<=x ; i++)
	{
		cnt+=x/(i*i*i);
	}
	return cnt;
}

int main(void)
{
	scanf("%lld",&m);
	lef=0; rig=9223372036854775807;
	while(lef<=rig)
	{
		mid=(lef+rig)/2;
		ll cur=func(mid);
		if(cur==m)
		{
			ok=1;
			best=mid;
			rig=mid-1;
		}
		else if(cur>m)
		{
			rig=mid-1;
		}
		else if(cur<m)
		{
			lef=mid+1;
		}
	}
	if(ok==1)
	{
		printf("%lld",best);
	}
	else
	{
		printf("-1");
	}
	return 0;
}

#include<stdio.h>
#define S 1000000000000000000
int flag=0;
__int64 n;
int ok(__int64 p)
{
	__int64 i,pn=0,one=0;
	for(i=2;i<p;i++)
	{
		one=p/(i*i*i);
		pn+=one;
		if(one==0)
			break;
	}
	if(pn==n)
		flag=1;
	return pn>=n?1:0;
}
int main()
{
	__int64 mid,l=1,r=S;
	scanf("%I64d",&n);
	while(r>=l)
	{
		mid=(l+r)/2;
		if(ok(mid))
			r=mid-1;
		else
			l=mid+1;
	}
	if(flag==0)
		printf("-1\n");
	else
		printf("%I64d\n",r+1);
	return 0;
}

#pragma comment(linker, "/STACK:99777216")
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

#define M_PI 3.14159265358979323846

using namespace std;

typedef unsigned __int64 ui;
typedef __int64 si;
typedef long long ll;

//string s;
ll m;
//map<char, int> f;

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> m;
	ll l = 1, r = 5e16, p = -1, s = 0;
	while (l <= r)
	{
		ll n = (l + r) / 2;
		s = 0;
		for (ll i = 2; i*i*i <= n; ++i)
		{
			s += n / (i*i*i);
		}
		p = s == m ? n : p;
		if (s >= m)
			r = n - 1;
		else
			l = n + 1;
	}
	cout << p << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s)
{
  return '"' + s + '"';
}

string to_string(const char *s)
{
  return to_string((string)s);
}

string to_string(bool b)
{
  return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
  string res = "";
  for (size_t i = 0; i < N; i++)
  {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v)
{
  bool first = true;
  string res = "{";
  for (const auto &x : v)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  long long m;
  cin >> m;
  auto check = [&](long long n) {
    long long no_a = 0LL;
    for (long long i = 2LL; i * i * i <= n; ++i)
    {
      no_a += n / (1ll* i * i * i);
    }
    return no_a;
  };
  long long hi = 1e18L, lo = 0, mid, ans = 1e18L;
  while (lo <= hi)
  {
    mid = (hi + lo) / 2;
    debug(mid);
    if (check(mid) < m)
    {
      lo = mid + 1;
    }
    else
    {
      ans = min (ans, mid);
      hi = mid - 1;
    }
  }
  if (check(ans) != m)
    ans = -1;
  cout << ans;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
	long long n, m, i, j, k, a, x, y, z, l;
	cin >> m;
	n = 1;
	for(i = 1; i <= 17; i++)
	n*=10;
	x = 1; y = n;
	while(x < y)
	{
		z = (x+y)/2;
		l = 0;
		for(j = 2; j*j*j <= z; j++)
		{
			l = l + z/(j*j*j);
		}
		if(l > m)
		{
			y = z-1;
		}
		else if(l < m)
		{
			x = z+1;
		}
		else if(l == m)
		{
			y = z;
		}
	}
	l = 0;
	for(j = 2; j*j*j <= x; j++)
		{
			l = l + x/(j*j*j);
		}
	if(l == m)
	cout << x << endl;
	else
	cout << "-1\n";
}

#include "bits/stdc++.h"
using namespace std;

long long compute(long long x) {
    long long y = 2;
    long long ans = 0;
    while (y * y * y <= x) {
        ans += x / (y * y * y);
        y++;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    long long m;
    cin >> m;

    long long hi = 1e17, lo = 0, mid, temp;
    long long idx = -1;

    while (hi > lo) {
        mid = lo / 2 + hi / 2;
        temp = compute(mid);
        if (temp >= m) {
            idx = mid;
            hi = mid;
        } else
            lo = mid + 1;
    }
    if (compute(idx) == m)
        cout << idx << endl;
    else
        cout << -1 << endl;
}

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define ll long long

using namespace std;

ll m;

ll fun(ll k){
	ll res = 0;
	for (ll i = 2; i*i*i <= k; i++){
		res += k / (i*i*i);
	}
	return res;
}

int main(){
	//freopen("input.txt", "r", stdin);
	cin >> m;
	long long l = 1, r = 10000000000000001;
	ll ans = -1;
	while (r>l){
		ll c = l + (r - l) / 2;
		ll t = fun(c);
		if (t == m) ans = c;
		if (t >= m){
			r = c;
		}
		else {
			l = c + 1;
		}
	}
	cout << ans;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define pi 3.141592653589793238462643383279502884197169399375105820974944592307816406286

typedef long double ld;
typedef long long ll;	// Use "%I64d" as placeholder with printf and scanf.
typedef unsigned long long int ulli;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef priority_queue<ll, vector<ll>, greater<ll>> min_heap_ll;
typedef priority_queue<ll, vector<ll>, less<ll>> max_heap_ll;

#define f(i, n) for(ll i=0; i<n; ++i)
#define fi(i, n, j) for(ll i=j; i<n; ++i)
#define pb push_back
#define ins insert
#define mp make_pair
#define all(container) container.begin(), container.end()
#define allr(container) container.rbegin(), container.rend()
#define tr(container, it) for (decltype(container.begin()) it = container.begin(); it != container.end(); it++)
#define trr(container, it) for (decltype(container.rbegin()) it = container.rbegin(); it != container.rend(); it++)
#define cpresent(container, element) (container.find(element) != container.end())
#define present(container, element) (find(all(container),element) != container.end())
#define dist(a, b) sqrtl(powl(ld(a.first - b.first), 2) + powl(ld(a.second - b.second), 2))

#ifdef _CODE_SOURCE
double start_time, end_time;
#endif

// useful functions
void my_return(ll code)
{
#ifdef _CODE_SOURCE
	end_time = clock();
	printf("\nTime = %.3f seconds\n", (end_time - start_time) / CLOCKS_PER_SEC);
#endif
	exit(code);
}

ll gcd(ll a, ll b)
{
	return b ? gcd(b, a % b) : a;
}

ll my_exp(ll a, ll b, ll MOD = numeric_limits<ll>::max())
{
	a %= MOD;
	if (b == 0)
	{
		return 1;
	}
	else
	{
		return ((b % 2 == 1 ? a : 1) * my_exp(a * a, b / 2, MOD)) % MOD;
	}
}

bool is_prime(ll n)	// O(sqrt(n)) implementation check for 0 and 1 separately
{
	if (n != 2 && n % 2 == 0)
	{
		return false;
	}
	else
	{
		for (int i = 3; (i*i) <= n; i += 2)
		{
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

// Program classes and structs

// Program functions

int main()
{
#ifdef _CODE_SOURCE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	start_time = clock();
#endif
	ios_base::sync_with_stdio(false);
	//Program Code
	ll m;
	cin >> m;
	ll left = 8, right = 1e16;
	ll mid;
	bool ans = false;
	while (left < right)
	{
		mid = (left + right) / 2;
		ll value = 0;
		fi(i, 1e6, 2)
		{
			value += (mid / (i*i*i));
			if (mid / (i*i*i) == 0)
			{
				break;
			}
		}
		if (value > m)
		{
			right = mid - 1;
		}
		else if (value < m)
		{
			left = mid + 1;
		}
		else
		{
			right = mid;
			ans = true;
		}
 	}
	if (ans)
	{
		cout << left;
	}
	else
	{
		cout << "-1";
	}
	my_return(0);
}

/*
 * yaswanth phani kommineni
 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll ways(ll n){
	ll res = 0;
	ll i = 2;
	while(pow(i,3)<=n){
		res+=n/((ll)pow(i,3));
		i++;
	}
	return res;
}

void solve(){
	ll m;
	cin >> m;
	ll l = 1,r = 1e16;
	while(l<=r){
		ll mid = l+(r-l)/2;
		ll wm = ways(mid);
		if(m>wm) l = mid+1;
		else r = mid-1;
	}
	if(ways(l) == m) cout << l << endl;
	else cout << -1 << endl;
}

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int z;
	z = 1;
	//cin >> z;
	for(int z1=1;z1<=z;z1++){
		solve();
	}
	return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <memory.h>
#include <set>
#include <ctime>
#include <map>
#include <cstring>
#include <iterator>
#include <queue>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ull unsigned long long
#pragma comment(linker, "/STACK:64000000")
#define null NULL
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fornr(i, n) for (int i = (n); i >= 0; --i)
#define forab(i, a, b) for (int i = (a); i < (b); ++i)

typedef long double ld;
typedef pair<ld, ld> pldld;
typedef long long ll;
typedef pair<ll, ll> pll;

typedef unsigned int ui;
typedef unsigned char uc;
const int infi = 1e9 + 7;
const ll infl = 1e18 + 7;

const ll mx = 10000000000000000LL;
ll check(ll n) {
	ll ans = 0;
	for (ll k = 2; ; ++k) {
		ll s = k * k * k;
		if (s > n)
			break;
		ans += n / s;
		if (ans >= mx)
			break;
	}
	return ans;
}

int main() {
	cin.sync_with_stdio(false);
	cin.tie(0);
//	freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	//freopen("ufo.in", "r", stdin);freopen("ufo.out", "w", stdout);
	ll m;
	cin >> m;
	ll l = 1, r = 1e18, ans = 0;
	while (l <= r) {
		ll mid = (l + r) >> 1;
		ll a = check(mid);
		if (a >= m) {
			ans = mid;
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	if (m != check(ans))
		ans = -1;
	cout << ans;

	return 0;
}

//#pragma warning(disable:4996)
#include<fstream>
#define N 10000000000000000
using namespace std;
long long m, st, ed,md , t[300003];
long long possible(long long x);
int main()
{
	long long p,q;
	long long k;

	for (k = 1; k <= 300000; k++) t[k] = k*k*k;

	scanf("%lld", &m);

	st = 1; ed = N;
	while (st<=ed) {
		md = (st + ed) / 2;
		p = possible(md);
		if (p == m)  break;
		if (p < m) st = md + 1;
		if (p > m) ed = md - 1;
	}

	while (st <= ed) {
		md = (st + ed) / 2;
		//printf("%lld %lld %lld\n", md,st,ed);
		p = possible(md);
		q = possible(md - 1);
		if (p == m && q < m) break;
		if (p < m) st = md + 1;
		if (p >= m) ed = md - 1;
	}

	if (p == m) printf("%lld", md);
	else printf("-1");
	return 0;
}

long long possible(long long x)
{
	long long k , p=0;
	for (k = 2; k <= 300000; k++) {
		p += x / t[k];
	}
	return p;
}

#include <iostream>
#include <stdio.h>
#include <numeric>
#include <queue>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <iomanip>
#include <set>
#include <queue>
#include <bitset>
#include <iomanip>
#include <map>
#include <string.h>
#include <stack>
#include <algorithm>

//#include <unordered_map>
//#include <unordered_set>

using namespace std;

// 小于等于n多少种方案
long long get_total(long long n)
{
	long long k , ans = 0;
	for (k = 2;k * k * k <= n;k ++)
	{
		long long temp = k * k * k;
		long long x = n / temp;
		ans += x;
	}
	return ans;
}

int main()
{
	long long i , j , m;
	while (scanf("%I64d" , &m) != EOF)
	{
		long long low = 1 , high = 1000000000000000000 , mid = 0 , temp;
		while (low <= high)
		{
			mid = low + (high - low) / 2;
			temp = get_total(mid);
			if (temp < m)
				low = mid + 1;
			else
				high = mid - 1;
		}

		low = (low - 10) >= 1 ? (low - 10) : 1;
		while ((temp = get_total(low)) < m)
			low ++;

		// 如果找到了
		if (temp == m)
			printf("%I64d\n" , low);
		else
			printf("%d\n" , - 1);
	}
	return 0;
}

#include <stdio.h>

long long check(long long);
long long check(long long n)
{
    long long minn = 0;
    for(long long k = 2;k * k * k <= n;k++)
        minn += n / (k * k * k);
    return minn;
}
int main()
{
    long long m,minn = -1,l = 1,r = 1e18,mid;
    scanf("%I64d",&m);
    while(r >= l)
    {
        mid = (l + r) / 2;
        long long num = check(mid);
        if(num == m)
            minn = mid;
        if(num >= m)
            r = mid - 1;
        else
            l = mid + 1;
    }
    printf("%I64d\n",minn);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ff(i,a,b) for(ll i = a;i<=b;i++)
#define fo(i,a,b) for(ll i = a;i<b;i++)
#define fod(i,a,b) for(ll i = a;i>=b;i--)
#define pb push_back
#define fi first
#define se second
#define mp make_pair
typedef pair <ll, ll> ii;
typedef vector <ll> vi;
const ll oo = 1e4;

ll n;
ll ans = -1;
ll f[1000000];

ll ok(ll x){
    ll res = 0;
    for(ll i = 2;i<=1e6;i++)
    {
        if(f[i]>x) return res;
        res += x/(i*i*i);
    }
    return res;
}

int main(){
    ff(i,2,oo)
    f[i] = i*1ll*i*1ll*i;
    cin>>n;
    ll hi = 1e18, lo = 1;
    while(hi!=lo)
    {
        ll mid = (lo+hi)>>1;
        if(ok(mid)>=n)hi = mid;
        else lo = mid+1;
//        cout<<lo<<" "<<hi<<endl;
    }
    if(ok(lo)==n)ans = lo;
    cout<<ans;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
#include<ctime>
using namespace std;
#define PI acos(-1.0)
#define ll long long
#define LS (root<<1)
#define RS ((root<<1)|1)
#define LSON LS,l,mid
#define RSON RS,(mid+1),r
#define MID mid=((l+r)/2)
#define PR pair<int,int>
#define MP make_pair
#define MAXN 200050
#define MAXE 2005000
#define INF 1e18
#define mm(a,b) memset(a,b,sizeof(a))
#define ll __int64
#define mod 29
#define PP puts("**************");
const double eps=1e-9;
template<class T> T f_max(T a, T b){ return a > b ? a : b; }
template<class T> T f_min(T a, T b){ return a < b ? a : b; }
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void swap(T *a, T *b){ T c; c = a; a = b; b = c; }
// 0x3f3f3f3f3f3f3f3f
// 0x3f3f3f3f

ll m;
ll cal(ll n){
    ll ans=0;
    for(ll k=2;n/(k*k*k)>0;k++){
        ans+=n/(k*k*k);
        if(ans>m)
            break;
    }
    if(ans==m)
        return 1;
    else if(ans>m)
        return 0;
    else
        return -1;
}
int main(){

    scanf("%I64d",&m);
    ll l=8,r=INF,ans=-1;
    while(l<=r){
        ll mid=(l+r)/2;
        ll flag=cal(mid);
        if(flag==1)
            ans=mid,r=mid-1;
        else if(flag==0)
            r=mid-1;
        else
            l=mid+1;
    }
    printf("%I64d\n",ans);
    return 0;
}

#include <iostream>
#include <cmath>

#define MAX 1e17

using namespace std;

long long int m;

long long int verify(long long int n) {

	long long int total = 0;

	for (long long int k = 2; k*k*k <= n; ++k) {
		//total += floor(n / (k*k*k));
		total += n / (k*k*k);
	}

	return total;
}

int main(int argc, char const *argv[]) {

	cin >> m;

	long long int beg = 0;
	long long int end = MAX;
	long long int mid;

	while (beg < end) {
		mid = (beg + end) / 2;
		if (verify(mid) < m)
			beg = mid + 1;
		else
			end = mid;
	}

	if (verify(beg) == m)
		cout << beg << '\n';
	else
		cout << "-1\n";

	return 0;
}
// 1493931436038

#include <iostream>
using namespace std;
/*
    Hotii fura asa:
    x, x*k, x*k*k, x*k*k*k
    Avem tuplurile astea:
    1   (1, 2, 4, 8)
    2   (2, 4, 8, 16)
    3   (3, 6, 12, 24)
    4   (1, 3, 9, 27)
    5   (1, 4, 16, 32)
    6   (5, 10, 20, 40)
    7   (6, 12, 24, 48)
    8   (2, 6, 18, 54)
    9   (7, 14, 28, 56)
    11  (1, 4, 16, 64), (8, 16, 32, 64)
    12  (9, 18, 36, 72)
    Ce se observa: 64 = 2^6 => 2^6, 2^5, 2^4, 2^3
                            => 2^6, 2^4, 2^2, 2^0
    Ne intereseaza numerele ce au in descompunerea in factori primi puteri mari astfel incat sa accepte scrierea
    in mai multe feluri
    2^9 => 2^9, 2^8, 2^7, 2^6
        => 2^9, 2^7, 2^5, 2^3
        => 2^9, 2^6, 2^3, 2^0
    Adica radical de ordin trei dintr-unul dintre factorii primi sa existe imi genereaza atatea combinatii cat este el
    Daca la intrare am n = 6 atunci se poate deoarece sunt primele 6 din enumerare
    Daca la intrare am n = 9 atunci se poate deoarece sunt primele 9 din enumerare
    Daca la intrare am n = 10 atunci NU se poate deoarece 64 genereaza doua combinatii
    Care este numarul de combinatii generate?
    radical de ordin 3 din 64 (2^6) este 4, si obtin doua combinatii
    radical de ordin 3 din 512 (2^9) este 8 si obtin trei combinatii
    Numarul de combinatii este numarul de k-uri diferiti pe care ii pot obtine
    2 <= k <= radical de ordin 3 din ( n / x )
    k fixat. Ma intereseaza cati de x am astfel incat
    x < x*k < x * k * k < x * k * k * k.
    Am nr NR. Parcurg totate val k posibile, intre 2 si o valoare val, a.i. val*val*val <= NR
    Pentru fiecare valoare vad cati de x indeplinesc x < x*k < x * k * k < x * k * k * k, adica NR / (k*k*k)
    Ar putea fi facut si cu o preprocesare: precalculez valorile intr-un vct...
*/

int main()
{
    ios_base::sync_with_stdio(false);
    ///int i; asta mi-a dat niste raspunsuri gresite si mi-a luat jum de ora sa imi dau seama...
    long long m, st = 1, dr = 1e16, rasp = -1, mij, nr_sol, i;
    cin >> m;
    while( st <= dr )
    {
        mij = (st + dr) / 2;
        nr_sol = 0;
        for( i = 2; i*i*i <= mij; ++i )
            nr_sol = nr_sol + ( mij / (i*i*i) );
        if( nr_sol == m )
            rasp = mij;
        //cout << nr_sol << endl;
        //cin.get();
        if( nr_sol >= m) /// Dc nu pun ">=" da raspuns prost pt ca se cere CEL MAI MIC posibil
            dr = mij - 1;
        else
            st = mij + 1;
    }
    cout << rasp;

    return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#define mp make_pair
#define pb push_back
#define S second
#define F first

using namespace std;
long long n, m, k, ok, ans = -1, cnt, i, l, r = (long long)1e16, mid;
long long comp(long long c)
{
	for(i = 2, cnt = 0; i * i * i <= c; i++)
		cnt += c / i / i/ i;
	return cnt;
}
main()
{
	cin >> m;
	while(l < r)
	{
		mid = (l + r) / 2;
		if(comp(mid) >= m)
			r = mid;
		else
			l = mid + 1;
		if(comp(mid) == m)
			ok = 1;
	}
	cout << (ok ? l : -1);

}

#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e18;
const int maxV = 1e6;

long long M;

void enter()
{
   cin >> M;
}

long long check(long long x)
{
   long long result = 0;
   for (int i = 2; i <= maxV; i++) {
      long long k = (long long) i * i * i;
      if (k > x) break;
      else result += x / k;
   }
   return result;
}

void process()
{
   long long low = 0, high = oo;
   while (low <= high) {
      long long mid = (low + high) / 2;
      if (check(mid) >= M) high = mid - 1;
      else low = mid + 1;
   }
   if (check(low) == M) cout << low << endl;
   else cout << -1 << endl;
}

int main()
{
   ios_base::sync_with_stdio(false); cin.tie(NULL);
   //freopen("TEMPLATE.inp", "r", stdin);
   //freopen("TEMPLATE.out", "w", stdout);

   enter();
   process();

   return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll m, l, r, mid;

ll c(ll n) {
	ll res = 0;
	for(ll q = 2; n >= q * q * q; q++) {
		res += n / (q * q * q);
	}
	return res;
}

int main() {
	cin >> m;
	l = 7;
	r = 100 * m;
	while(r - l > 1) {
		mid = (l + r) >> 1;
		if(c(mid) >= m) {
			r = mid;
		}
		else {
			l = mid;
		}
	}
	if(c(r) == m) {
		cout << r << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll m, lo, mid, hi;
ll bag(ll mid) {
  ll cnt = 0;
  for(ll k = 2; (k * k * k) <= mid; ++k) {
    cnt += mid / (k * k * k);
  }
  return cnt;
}
int main() {
  cin >> m;
  lo = 0;
  hi = 8e15 + 9;
  while(lo < hi) {
    mid = (lo + hi) / 2;
    if(bag(mid) >= m) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  if(bag(lo) == m) {
    cout << lo << endl;
  } else {
    cout << "-1" << endl;
  }
  return 0;
}
// 1508997525463

#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<queue>
#include<math.h>
#include<map>
#define INF 0xffffffff
#define MAX 1e18
#define Temp 1000000000
#define MOD 1000000007

using namespace std;

long long n;
int ok;

long long Check(long long m)
{
    long long ans=0;
    for(long long i=2;i*i*i<=m;i++)
    {
        ans+=(m/(i*i*i));
    }
    return ans;
}

long long Find()
{
    long long L=1,R=MAX,ans;
    while(L<=R)
    {
        long long Mid=(L+R)/2;
        long long t =Check(Mid);
        if(t > n)
            R=Mid-1;
        else if(t < n)
            L=Mid+1;
        else
        {
            ok=1;
            ans=Mid;
            R=Mid-1;
        }

    }
    return ans;
}

int main()
{
    while(scanf("%lld",&n)!=EOF)
    {
        ok=0;
        long long ans=Find();
        if(!ok)
            printf("-1\n");
        else
            printf("%lld\n",ans);
    }
    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <map>
using namespace std;
long long num[200010], m;
int n;

void init()
{
	memset(num, 0, sizeof(num));
	for (int i = 2; i <= 200000; i++)
	{
		num[i] = (long long)i*(long long)i*(long long)i;
	}
}

int judge(long long now)
{
	long long cnt = 0;
	int i;
	for (i = 2; i <= 200000; i++)
	{
		//cout << i << endl;
		if (num[i] > now) break;
		else cnt += now / num[i];
	}

	if (cnt > m) return 2;
	else if (cnt == m) return 1;
	else return 0;
}

int main()
{
	init();
	scanf("%lld", &m);
	long long le = 0, ri = 1e18;
	long long mid;
	while (le < ri)
	{
		mid = (le + ri) / 2;
		//cout << le << " " << ri << endl;
		int flag = judge(mid);
		if (flag > 0)
		{
			ri = mid;
		}
		else le = mid + 1;
	}
	if (judge(ri) == 1)printf("%lld\n", ri);
	else if (judge(mid) == 1) printf("%lld\n", mid);
	else if (judge(le) == 1)printf("%lld\n", le);
	else printf("-1\n");
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
long long f(long long m)
{
    ll ans=0;
    for(ll i=2;(i * i  *i) <= m;i++)
        ans+=m/(i*i*i);
    return ans;
}
int main()
{
    long long n;cin>>n;
    long long l=1,r=(long long)5e15+10;
    while((r-l)>0)
    {
        long long m=(r+l)/2;
        if(n==f(m))
        {
            while(f(m)==f(m-1))
                m--;
            cout<<m;
            return 0;
        }
        if(n > f(m))
            l = m + 1;
        else
            r = m;
    }
    cout<<-1;
    return 0;
}

//Kaori Miyazono, did I reach you ?
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	lli ways;
	cin >> ways;
	lli lo = 1, hi = 1e18, ans = -1;
	while(lo <= hi){
		lli mid = (lo + hi) >> 1;
		//cout << mid << ' ';
		lli at = 2, tot = 0, now;
		while(1){
			now = mid / (at * at * at);
			if ( now == 0 || tot > ways ) break;
			tot += now;
			at++;
		}
		//cout << tot << endl;
		if ( tot == ways ){
			ans = mid;
			hi = mid - 1;
		}
		else if ( tot > ways ){
			hi = mid - 1;
		}
		else{
			lo = mid + 1;
		}
	}
	cout << ans;
	return 0;
}
// 1507780773554

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <queue>
#include <iomanip>
#define INF 105
using namespace std;
typedef long long ll;

ll check(ll n){
	ll ret=0;
	for(ll q=2;q*q*q<=n;q++){
		ret+=n/(q*q*q);
	}
	return ret;
}

int main()
{
    ll l=1,r=1ll<<62,m,mid,ans=-1;
	cin>>m;
	while(l<r){
		mid=(l+r)/2;
		ll num=check(mid);
		if(num<m) l=mid+1;
		else{
			if(num==m)
			ans=mid;
			r=mid;
		}
	}
	if(check(ans)==m) cout<<ans<<endl;
	else cout<<-1<<endl;
    return 0;
}

#include<stdio.h>
typedef long long ll;
ll check(ll n)
{
    ll res=0;
    for(ll k=2; k*k*k<=n; k++)//k是ll范围  不可犯糊涂
        res+=n/(k*k*k);
    return res;
}
int main()
{
    ll m,res=-1,l=1,r=1e18,mid;
    scanf("%I64d",&m);
    while(r>=l)
    {
        mid=(l+r)/2;
        ll num= check(mid);
        if(num==m)
            res=mid;
        if(num>=m)
            r=mid-1;
        else
            l=mid+1;
    }
    printf("%I64d\n",res);
}

#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

long long busca_bin(long long m){
	long long n=-1, r;

	long long ini=1, mid, fim = pow(2, 60);
	while(ini <= fim){
		mid = (ini+fim)/2;

		r = 0;
		for(long long k=2; k*k*k <= mid; k++)
			r = r + (mid/(k*k*k));

		if(r == m)
			n = mid;
		if(r >= m)
			fim = mid-1;
		else
			ini = mid+1;
	}
	return n;
}

int main(void){
	long long m;
	while(cin >> m){
		long long n = busca_bin(m);
		cout << n << endl;
	}
	return 0;
}
// 1494013247728

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long  int ll;
typedef long double db;
#define pb push_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define pi 3.1415926535
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for( i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll M = 1e9 + 7;
ll inf = 1e18;

ll n, m;

int main() {
	// your code goes here
	IOS;

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll i, j, t, k, x, y, z,  N;
	cin >> m;
	N = 1e6 + 1;
	ll l = 0, r = 1e16, mid, ans = -1;
	while (l <= r) {
		mid = (l + r) / 2;
		x = 0;
		for (i = 2; i <= N; i++) {
			x += mid / ll(pow(i, 3));
		}
		if (x >= m) {
			ans = mid;
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	x = 0;
	for (i = 2; i <= N; i++) {
		x += ans / ll( pow(i, 3));
	}
	if (x == m) {
		cout << ans;
	}
	else
		cout << -1;

	return 0;

}

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stdio.h>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#define p(x,y) pair<x,y>
#define SZ(v) (int)v.size()
#define mp(x,y) make_pair(x,y)
#define MOD 1000000007
#define MAXN 200005
using namespace std;
typedef long long ll;
ll m,l = 0,r = 1e18;
ll check(ll n){
	ll ans = 0;
	for(ll k = 2;k*k*k <= n;k++)
		ans += n / k / k / k;
	return ans;
}
int main(){
	cin>>m;
	while(r-l>1){
		ll mid = (l+r)>>1;
		if(check(mid) >= m)r = mid;
		else l = mid;
	}
	if(check(l) == m)cout<<l<<endl;
	else if(check(r) == m)cout<<r<<endl;
	else cout<<-1<<endl;
}

#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

#define MIN(A,B) (((A)>(B)) ? (B):(A))
#define MAX(A,B) (((A)<(B)) ? (B):(A))

long long n;
long long cache[10000000];

long long find(long long k)
{
	long long a = 0;
	for (int j = 2;; j++)
	{
		long long & J = cache[j];
		if (J == -1)
			J = (long long)j*(long long)j*(long long)j;
		if (J > k)
			break;
		a += k / J;
	}
	return a;
}

int main()
{
	cin >> n;
	memset(cache, -1, sizeof(cache));
	int i;

	long long begin = 1;
	long long end = 8*n;
	long long mid;
	int flag;
	while (1)
	{
		mid = (begin + end) / 2;
		long long M = find(mid);

		if (begin == mid)
		{
			if (M == n)
				flag = 0;
			else if (M > n)
				flag = 1;
			else if (find(end) == n)
			{
				mid = end;
				flag = 0;
			}
			else
			{
				flag = 1;
			}
			break;
		}

		if (M >= n)
		{
			end = mid;
		}
		else
		{
			begin = mid;
		}
	}

	if (flag==0)
		cout << mid;
	else
		cout << -1;
	return 0;
}

#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll m;

ll pos(ll n)
{
    ll temp=0;
    ll k=2;
    while(1)
    {
        ll x = n/(k*k*k);
        if(x==0)
            break;
        temp+=x;
        k++;
    }
    return temp;
}

int main()
{
    cin>>m;
    ll low=0,mid,high=10000000000000000;
    ll ans=-1,tmp,stor;
    for(int i=1; i<=100; i++)
    {
        mid = (low+high)/2;
        tmp = pos(mid);
        if(tmp>=m)
        {
            stor=tmp;
            ans=mid;
            high=mid;
        }
        else
            low=mid;
    }
    if(stor!=m)
        ans=-1;

    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll m;

ll pos(ll n)
{
    ll temp=0;
    ll k=2;
    while(1)
    {
        ll x = n/(k*k*k);
        if(x==0)
            break;
        temp+=x;
        k++;
    }
    return temp;
}

int main()
{
    cin>>m;
    ll low=0,mid,high=4949100894494448;
    ll ans=-1,tmp,stor;
    while(low<=high)
    {
        mid = (low+high)/2;
        tmp = pos(mid);
        if(tmp>=m)
        {
            stor=tmp;
            ans=mid;
            high=mid-1;
        }
        else
            low=mid+1;
    }
    if(stor!=m)
        ans=-1;

    cout<<ans<<endl;
    return 0;
}

#include<iostream>

using namespace std;
long long m;
long long es(long long tem)
{
	long long cont=0;
	for(long long k=2;k*k*k<=tem;k++)
	{
		long long a=(tem/(k*k*k));
		if(a==0)
		{
			return cont;
		}
		else
		{
			cont+=a;
		}
	}
	return cont;
}
int main()
{
	cin>>m;
	long long ini=8,fin=10000000000000000;
	while(ini<fin)
	{
		long long tem=ini+fin;
		tem=tem>>1;
	//	cout<<tem<<" "<<es(tem)<<"a"<<'\n';
		if(es(tem)<m)
		{
			ini=tem+1;
		}
		else
		{
			fin=tem;
		}
	}
	if(es(ini)==m)
	{
		cout<<ini;
	}
	else
	{
		cout<<-1;
	}
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define MP make_pair
#define PB push_back
#define N 100009
#define MOD 1000000007
#define f first
#define s second
#define wt(x) cout << # x <<" = " << x << endl
#define FASTIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define inf 1e16
using namespace std;
void read(ll a= 0 )
{freopen("in","r",stdin);       if (a)  freopen("out","w",stdout); }

ll opnum ( ll n )
{

    ll ans = 0 ;
    for(ll i = 2; i * i * i <= n ; i++)
        ans += n / ( i * i * i );
    return ans ;
}
int main ()
{

    ll m ;
    ll ans  =  - 1 ;
    cin >> m ;
    ll lo  = 1 , hi =1e16;
    while(lo <= hi )
    {
        ll mid =(lo +  hi ) >> 1 ;
        if ( opnum  ( mid ) == m ) ans = mid ;
        if ( opnum ( mid )>= m ) hi = mid - 1 ;
        else lo = mid + 1 ;

    }
    cout << ans ;

}

#include<bits/stdc++.h>
using namespace std ;
long long check(long long num)
{
    long long sum=0 ;
    for(long long i=2 ; i<200002 ; i++)
    {
        if(i*i*i<=num)
        {
            sum+=num/(i*i*i) ;
        }
        else break ;
    }
    return sum ;
}
int main()
{
    long long m ;
    cin >> m ;
    long long h=m*8 ;
    long long l=0 ;
    long long mid ;
    int f=0 ;
    long long sol = 8*10e15+10 ;
    long long temp ;
    while(l<=h)
    {
        mid=(l+h)/2 ;
        temp=check(mid) ;
        if(temp>m) h=mid-1 ;
        else if(temp==m) { f=1 ; if(sol>mid) sol=mid ; h=mid-1 ; }
        else l=mid+1 ;
    }
    if(f==0) cout << "-1" ;
    else cout << sol ;
    return 0 ;
}

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll bs_true_left(ll A, ll B, function<bool(ll)> f)
{
    bool found = false;
    while ((B - A) > 1LL) {
        ll mid = A + ((B - A) >> 1LL);
        auto test = f(mid);

        if (test)
            found = true;

        if (!test) {
            B = mid;
        } else {
            A = mid;
        }
    }
    return found ? A : 0;
}

ll calc_variants2(ll n)
{
    ll m = 0;
    for (ll k = 2; ; ++k)
    {
        auto k3 = k * k * k;
        if (k3 > n)
            break;
        // a = [1, h], h * k3 <= n
        auto h = n / k3;
        m += h;
    }
    return m;
}

ll calc_variants_stupid(ll n)
{
    ll m = 0;
    for (ll a = 1; a * 8 <= n; ++a) {
        for (ll k = 2; a * k * k * k <= n; ++k) {
            m++;
            // printf("(%I64d, %I64d, %I64d, %I64d)\n", a, a * k, a * k * k, a * k * k * k);
        }
    }
    return m;
}
ll calc_variants(ll n)
{
    ll m = 0;
    for (ll a = 1; a * 8 <= n; ++a) {
        auto ret = bs_true_left(1, n / 3, [a,n](ll x) {return (bool)(a * x * x * x <= n);});
        if (ret > 0)
            m += ret - 2 + 1;
    }
    return m;

    for (ll a = 1; a * 8 <= n; ++a) {
        for (ll k1 = 2; a * k1 * 2 * 2 <= n; ++k1) {
            for (ll k2 = 2; a * k1 * k2 * 2 <= n; ++k2) {
                for (ll k3 = 2; a * k1 * k2 * k3 <= n; ++k3) {
                    m++;
                    printf("(%I64d, %I64d, %I64d, %I64d)\n", a, a * k1, a * k1 * k2, a * k1 * k2 * k3);
                }
            }
        }
    }
    return m;

    for (ll k = 2; ; ++k) {
        ll k2 = k*k, k3 = k2 * k;
        if (k3 > n)
            break;
        for (ll a = 1; a <= n / k3; ++a) {
            for (ll b = a * k; b <= n / k2; ++b) {
                for (ll c = b * k; c <= n / k; ++c) {
                    ll variants = n - c * k + 1;
                    if (variants > 0) {
                        m += variants;
                        printf("(%I64d, %I64d, %I64d, %I64d)\n", a, b, c, variants);
                    }
                }
            }
        }
    }
    return m;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //printf("%I64d\n",calc_variants_stupid(1e7));
    //printf("%I64d\n",calc_variants(1e7));
//    printf("%I64d\n",calc_variants2(1e18));
//    return 0;
    ll n;
    while (scanf("%I64d\n", &n) > 0) {
            //bin_search
            // left (l, r]
            ll A = -1LL, B = 1e18;
            bool found = false;
            while ((B - A) > 1LL) {
                ll mid = A + ((B - A) >> 1LL);
                auto test = calc_variants2(mid);

                if (test == n)
                    found = true;

                if (test >= n) {
                    B = mid;
                } else {
                    A = mid;
                }
            }
            if (found) {
                printf("%I64d\n", B);
            } else
                puts("-1");
    }
    return 0;
}

#include <bits/stdc++.h>
#define ll long long int
using namespace std;

unsigned long long int f(unsigned long long int n, long long int m)
{
    unsigned long long int s = 0;
    for (unsigned long long int k = 2; k <= 1e6; k++)
    {

        unsigned long long int val = k*k*k;
        unsigned long long int v = (n / val);
        // cout << n << " " << k << " " << v << endl;
        s += v;
        if (v == 0)
        {
            break;
        }

        // if(k<=4){

        //  cout << s << endl;
        // }

    }

    return s;
}

int main()
{
    // cout << ((unsigned ll)4949100895143672/((ll)1000000000000000));
    // cout << f(4949100895143672, 1) << endl;
    ll m;
    cin >> m;

    // while(m)

    long long int l = 0;
    long long int r = 1e16;
    // bool f = true;
    while (l < r)
    {
        // cout << l << " " << r << endl;
        long long int mid = l + (r - l) / 2;
        long long int s = f(mid, m);
        if (s == m)
        {
            // cout << s << endl;
            if (mid > 0){
                s = f(mid-1, m);
                if(s==m){
                    r = mid;
                }
                else{
                    cout << mid << endl;
                    return 0;
                }
            }
            // r = mid;
        }
        else if (s > m)
        {
            r = mid;
        }
        else
        {
            l = mid + 1;
        }
    }

    cout << -1 << endl;
}

#include <iostream>

using namespace std;

long long int liczba_rozwiazan;

long long int ilosc_kom(long long int pojemnosc_plec) {
    long long int wyn = 0;

    for(long long int i = 2; i <= 1000000; ++i) {
        long long int do_trzec = i*i*i;

        long long int ile_razy = pojemnosc_plec / do_trzec;

        if(ile_razy == 0) {
            return wyn;
        }
        wyn += ile_razy;

    }

    return wyn;

}

long long int wyszukaj_binarnie() {
    long long int pocz = 1;
    long long int kon = 5000000000000000;

    while(kon - pocz > 1) {
        long long int srod = (pocz + kon) / 2;

        if(ilosc_kom(srod) >= liczba_rozwiazan) {
            kon = srod;
        } else {
            pocz = srod;
        }
    }

    if(ilosc_kom(pocz) == liczba_rozwiazan) {
        return pocz;
    }
    if(ilosc_kom(kon) == liczba_rozwiazan) {
        return kon;
    }
    return -1;
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> liczba_rozwiazan;

    cout << wyszukaj_binarnie() << endl;

    return 0;
}

#include <iostream>
#include<cmath>
using namespace std;
long long caut(long long n)
{ long long a=0,i;
long double r;
r=pow(n,1./3);
    for(i=2;i<=r+1;i++)
        a=a+n/(i*i*i);
return a;
}
int main()
{
    long long m,n=-1,ls=0,ld=10000000000000000,mij;
    cin>>m;
  //  long double r;
//r=pow(m,1./3); cout<<r<<endl;
  //  int ok=0;

    do{
        mij=(ls+ld)/2;

        if(caut(mij)<m)
            ls=mij+1;
        else ld=mij;
    }while(ls<ld);
if(caut(ls)==m)n=ls;
    cout<<n<<"\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int main(){
	#ifdef The_Fusy
		freopen("input","r",stdin);
		freopen("output","w",stdout);
	#endif
	ll n;
	cin>>n;
	ll l=8;
	ll r=1e17;
	while(l<r){
		ll pp=0;
		ll mid = (l+r)/2;
		for(ll i=2;i<mid;i++){
			ll a = i*i*i;
			if(a>mid) break;
			else pp+=(mid/a);
		}
		if(pp>=n) r=mid;
		else l=mid+1;
	}
	ll pp=0;
	for(ll i=2;i<l;i++){
		ll a = i*i*i;
		if(a>l) break;
		else pp+=(l/a);
	}
	//cout<<"l = "<<l<<endl;
	//cout<<"r = "<<r<<endl;
	//cout<<"pp = "<<pp<<endl;
	if(pp==n) cout<<l;
	else cout<<-1;
}

#include <bits/stdc++.h>
using namespace std;
double A = 1.20;
static long long m;
long long compute(long long n){
    long long k = 2;
    long long ans = 0;
    while(true){
        long long x = floor(n / ((long long) (k*k*k)));
        ans += x;
        if(x == 0){
            break;
        }
        k += 1;
    }
    return ans;
}/*
long long compute(long long x){
    long long y = ceil(pow(x,1.0/3));
    long long  ans = 0;
    for(long long i = 2; i < y+1; ++i){
        ans += x/(i*i*i);
    }
    return ans;
}*/
long long bin(long long l, long long r){
    if(r>= l){
        long long mid = l + (r-l)/2;
        long long a = compute(mid);
        if(a == m){
            return mid;
        }
        if(a >m){
            return bin(l, mid - 1);
        }
        return bin(mid+1, r);
    }
    return -1;
}
long long mins(long long a, long long b){
    if(a>b){
        return a;
    }
    return b;
}
int main(){
    cin >> m;
    long long low = floor(m/A);
    long long temp = bin(1, 8*m);
    bool bad = false;
   /* if(compute(temp) != m){
        cout << -1;
        return 0;
    }
    while(!bad){
        temp--;
        if(compute(temp) != m){
            bad = true;
        }
    }
    cout<< temp + 1;*/
    for(long long i = mins(temp - 20, 0); i<= temp; i++){
        if(compute(i) == m){
            cout << i;
            return 0;
        }
    }
    cout << -1;
    return 0;
}

#include <stdio.h>
int main()
{
	long long m,n,i,j,t,l=0,r=1e16,ans;
	scanf("%lld",&n);
	while(l<=r)
	{
		t=0;
		m=(l+r)/2;
		for(i=2;i*i*i<=m;i++)
		{
			t+=m/(i*i*i);
			if(t>n) break;
		}
		if(t>=n)
		{
			r=m-1;
			ans=m;
		}
		else l=m+1;
	}
	t=0;
	for(i=2;i*i*i<=ans;i++)
		t+=ans/(i*i*i);
	if(t==n) printf("%lld\n",ans);
	else puts("-1");
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int solve(ll n,ll m){
	ll sol=0;
	for (ll i=2;i*i*i<=n;i++){
		sol+=n/(i*i*i);
	}
	// cout<<"sol "<<sol<<"m "<<m<<endl;
	if (sol==m){
		return 0;
	}else if (sol>m){
		return 1;
	}else{
		return -1;
	}
}

int main(int argc, char const *argv[])
{
	ll m;
	cin>>m;
	ll l=0;
	ll r=pow(10,17);
	ll ans=pow(10,17)+1;
	while (l<=r){
		ll mid=l+(r-l)/2;
		// cout<<"l "<<l<<"r "<<r<<"mid "<<mid<<endl;
		int tans=solve(mid,m);
		if (tans==0){
			if (mid<ans)
				ans=mid;
			//find smaller
			r=mid-1;
		}else if (tans==1)
		{
			r=mid-1;
		}else
			l=mid+1;

	}
	if (ans==(pow(10,17)+1))
		cout<<"-1";
	else
		cout<<ans;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;

#define MAXN 100001
#define MOD 1000000007

LL M;

LL f(LL n) {
    LL ret = 0;
    for (int i = 2; ret < n; i++) {
        LL p = 1LL * i * i*i;
        if (p > n) break;

        ret += n / p;
    }

    return ret;
}

int main(int argc, char** argv) {
#ifdef OJ
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(false);

    cin >> M;
    LL l = -1, r = (LL) 1e18 + 1;
    while (r - l > 1) {
        LL m = l + (r - l) / 2;
        if (f(m) >= M)
            r = m;
        else
            l = m;
    }

    if (f(r) == M)
        cout << r << endl;
    else
        cout << -1 << endl;

    return 0;
}

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll m;
bool ok (ll n){
	ll sum=0;
	for (ll k=2;k*k*k<=n;k++){
		sum+=n/(k*k*k);
	}
	if (sum<m){
		return 0;
	}else {
		return 1;
	}
}
bool ok1 (ll n){
	ll sum=0;
	for (ll k=2;k*k*k<=n;k++){
		sum+=n/(k*k*k);
	}
	if (sum==m){
		return 0;
	}else {
		return 1;
	}
}
long long binarysearch (){
	ll st=0,en=1e18;
	while (st<en){
		ll n=(st+en)/2;
		if (ok (n)){
			en=n;
		}else {
			st=n+1;
		}
	}
	if (ok1(st)){
		return -2;
	}else {
		return st;
	}
}
int main()
{
    cin >>m;
    if (binarysearch()==-2){
		cout <<"-1\n";
		return 0;
    }else {
		cout <<binarysearch()<<endl;
    }
    return 0;
}

//In The Name of Beauty

//harchi bood gozasht faghat jaye zakhmesh moond
//minevisam o minevisam o bala mire gardesh khoon
//rozio mibinam jori halam khoobe ke chasbidam be saghf
//oon rooz age mano didi faghat begoo haghesh bood...
//YAS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef map<ll,ll> mllll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define F first
#define S second
#define trvall(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define MAXN (ll)1e18 + 8
#define INF  (ll)1e12 + 8
ll const delta = 1000000007;

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll l = 0 , r = MAXN - 1,mid = l + ((r - l) / 2);
    while(r - l > 1)
    {
        ll temp = 0;
        ll j = 2;
        while(mid / (j * j * j) > 0)
        {
            temp += (mid / (j * j * j));
            j++;
        }
        if(temp >= n)r = mid;
        else l = mid;
        mid = l + ((r - l) / 2);
    }
    ll ans1 = 0 , ans2 = 0,ans3 = 0;
    for(ll i = 2;i < MAXN;i++)
    {
        ans1 += (l / (i * i * i));
        ans2 += (mid / (i * i * i));
        ans3 += (r / (i * i * i));
        if(mid / (i * i * i) < 1 && l / (i * i * i) < 1 && r / (i * i * i) < 1)break;
    }
    if(ans1 == n)cout << l;
    else if(ans2 == n)cout << mid;
    else if(ans3 == n)cout << r;
    else cout << -1;
    return 0;
}
//Written by M_H_H_7

#include <bits/stdc++.h>

#define oo 1000000007
#define OO 5000000000000001
#define maxN 300005
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define bug(a) cout << #a << " = " << a << endl;
#define fbug(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define mp make_pair
#define pb push_back
#define pf push_front
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define ull unsigned long long
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define FF first
#define SS second
#define mt make_tuple
#define eb emplace_back

using namespace std;

ll Max() {return -OO;}
ll Min() {return  OO;}

template <typename... Args>
ll Max(ll a, Args... args) {return max(a, Max(args...));}

template <typename... Args>
ll Min(ll a, Args... args) {return min(a, Min(args...));}

ll p3 (ll i) {
    ll ans = 1LL;
    return ans = i*i*i;
}

ll answer (ll n) {
    ll ways = 0LL;
    fto (i, 2, 1000001) {
        ll pow3 = p3((ll)i);
        ways += n/pow3;
    }
    return ways;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    ll m;
    scanf("%lld", &m);

    ll left = 1LL;
    ll right = OO;

    while (left != right-1LL) {
        ll mid = (left+right)/2LL;
        ll ways = 0LL;
        fto (i, 2, 1000001) {
            ll pow3 = p3(i);
            ways += mid/pow3;
        }
        if (ways < m) left = mid;
        else right = mid;
    }

    if (answer(right) != m) {
        puts("-1");
        return 0;
    }

    printf("%lld", right);

    #ifndef ONLINE_JUDGE
        cout << endl;
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif

    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;

long long cal(long long t)
{
  long long i;
  long long sum=0,ans;
  for(i=2;i<=1e6;i++)
    {
      ans=t/(i*i*i);
      sum+=ans;
      if(ans==0)
        break;
    }
    return sum;
}
int main()
{
  long long m;
  cin>>m;
  long long L=0,R=1e18;
  while(L<=R)
  {
    long long mid=(L+R)/2;
    if(cal(mid)>=m)
      R=mid-1;
    else
      L=mid+1;
  }
  if(cal(L)==m)
    printf("%I64d\n",L);
  else
    printf("-1\n");
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	long long m;
	cin >> m;

	long long l = 1, r = 1e18;
	while(l <= r)
	{
		long long n = (l + r)/2;
		long long cnt = 0;
		for(long long i = 2; i*i*i <= n; i++) cnt += n/(i*i*i);
		if(cnt >= m) r = n - 1;
		else l = n + 1;
	}
	long long n = r + 1;
	long long cnt = 0;
	for(long long i = 2; i*i*i <= n; i++) cnt += n/(i*i*i);
	if(cnt == m) cout << n;
	else cout << -1;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define MAXSIZE 	1e16
long long int powerof3(long long int k)
{
		return k*k*k;
}
long long int number_of_ways(long long int n)
{
		long long int count = 0;
		//cout <<"calculating for " << n << endl;
		for(long long int k=2;k*k*k<=n;k++)
		{
				count += n/(powerof3(k));
		}
		return count;
}
int main()
{
	    long long	int m;
		cin >> m;
		long long int hi = MAXSIZE , lo = 8;
		int flag =1;
		while(lo<hi)
		{
				long long int mid = (lo + hi)/2;
				long long int noOfways = number_of_ways(mid);
				if(noOfways == m)
				{
						flag =0;
						hi = mid;
				}
				else if(noOfways > m)
				{
						hi = mid;
				}
				else
						lo = mid + 1;
				//cout << "lo is "<< lo << " hi is "<< hi << " noOfways" << noOfways << " and mid is " << mid << endl;
		}
		if(flag ==1)
				cout << "-1" << endl;
		else
				cout << lo << endl;
return 0;
}

#include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <string>
#include <sstream>
#include <regex>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <cmath>
#include <cstring>
#include <climits>
using namespace std;
typedef long long ll;
#define fori(i,n)   for (int           _n = (n), i = 0   ; i <  _n; ++i)
#define foro(i,k,n) for (int _k = (k), _n = (n), i = _k  ; i <  _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n-1; i >= _k; --i)
#define inf   ((int)2e9+2)
#define infll ((ll)9e18+9)

ll numcom(ll lim) {
    ll res = 0;
    ll k = 2;
    ll inrow;
    for (;;) {
        if ((inrow = lim / (k * k * k)) <= 0) break;
        res += inrow;
        ++k;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    //foro(i, 1, 101) {
    //    cout << i << " " << numcom(i) << endl;
    //}
    //return 0;

    ll m; cin >> m;
    ll hi = 8 * m;
    ll lo = 8;
    while (lo < hi) {
        ll mid = (lo + hi) / 2;
        if (numcom(mid) >= m) hi = mid;
        else lo = mid + 1;
    }
    if (numcom(lo) == m) cout << lo << endl;
    else cout << "-1\n";

    return 0;
}

#include <bits/stdc++.h>

using namespace std;
//TO FAZENDOE SSE PORRA

typedef long long ll;

ll binary (ll mid){
    ll i=2, possibilities = 0;
    while (i*i*i <= mid){
        possibilities += mid/(i*i*i);
        i++;
    }

    return possibilities;
}

int main (){
    ll m, min, max;
    scanf ("%I64d", &m);

    min = -1;
    max = 1e16;
    while (max>min+1){
        ll mid = (min+max)/2;

        if (binary (mid) >= m){
            max = mid;
        } else {
            min = mid;
        }
    }

    if (binary(max)==m){
        printf ("%I64d\n", max);
    } else {
        printf ("-1\n");
    }

    return 0;
}

#include <bits/stdc++.h>
#define x first
#define y second
#define debug(x) printf("%d\n", x)

using namespace std;

long long m;

long long simulate(long long num){
	long long howmany = 0;
	for(long long k = 2; k*k*k<=num;k++){
		howmany += num/(k*k*k);
	}
	return howmany;
}

int main(){
	cin >> m;
	long long l = 0, r = 1e16, mid;
	while(l!=r){
		mid = (l+r)/2;
		if(simulate(mid)>=m)
			r = mid;
		else
			l = mid+1;
	}
	if(simulate(l)==m)
		cout << l <<endl;
	else
		cout << "-1" << endl;

	return 0;
}

// 1508467141770

#include"cstdio"
#include"queue"
#include"cmath"
#include"stack"
#include"iostream"
#include"algorithm"
#include"cstring"
#include"queue"
#include"map"
#include"set"
#include"vector"
#define LL long long
#define ull unsigned long long
#define mems(a,b) memset(a,b,sizeof(a))
#define ls pos<<1
#define rs pos<<1|1
#define lson L,mid,pos<<1
#define rson mid+1,R,pos<<1|1
using namespace std;

const int N = 1e6+5;
const int M = 55*55;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

LL n,m;
LL b[N];

LL check(LL mid){
    LL tot=0;
    for(int i=2;i<N;i++) tot+=mid/b[i];
    return tot;
}

int main(){
    for(int i=2;i<N;i++) b[i]=(LL)i*i*i;
    scanf("%I64d",&m);
    LL ans=-1;
    LL low=8,high=1e18,mid;
    while(low<=high){
        mid=(low+high)>>1;
        LL t=check(mid);
        //cout<<mid<<' '<<t<<endl;
        if(t==m){
            ans=mid;
            high=mid-1;
        }
        else if(t<m) low=mid+1;
        else high=mid-1;
    }
    cout<<ans;
    return 0;
}

#include<iostream>
using namespace std;
long long int f( long long int x)
{
    long long int sum=0;
    long long int i=2;
    while(x>=i*i*i) {sum+=x/((i*i)*i); i++;}
    return sum;
}
long long int m;
long long int lower_bound(long long int l ,long long  int r)
{
    while(l<r)
    {
        long long int mid=(l+r)/2;
        //cout<<f(mid)<<"\n";
        if(f(mid)>=m) return lower_bound(l,mid);
        return lower_bound(mid+1,r);
    }
    if(f(l)==m) return l;
    return -1;
}
int main()
{
    cin>>m;
    cout<<lower_bound(1,1e18);
}

#include <iostream>
#include <climits>

using namespace std;

unsigned long long test(unsigned long long m) {
	unsigned long long c = 0;
	for(unsigned long long i = 2 ; (i*i*i) <= m ; ++i){
		unsigned long long _pot = i*i*i;
		unsigned long long l = 1, r = (m/_pot)+1;
		bool found = false;
		unsigned long long mid, a0_pot;
		while(r-l > 1 && !found){
			mid = (l+((r-l)>>1));
			a0_pot = mid*_pot;
			if(a0_pot == m){
				found = true;
				break;
			}
			else if(a0_pot < m)
				l = mid;
			else
				r = mid;
		}
		if(found){
			c += mid;
		}
		else{
			if(r*_pot <= m)
				c += r;
			else if(l*_pot <= m)
				c += l;
		}
	}
	return c;
}

int main() {
	unsigned long long n;
	cin >> n;
	unsigned long long l = 0, r = ULLONG_MAX;
	while(r-l > 1) {
		unsigned long long m = (l+((r-l)>>1));
		unsigned long long _try = test(m);
		if(_try < n){
			l = m;
		}
		else
			r = m;
	}
	if(test(l) == n)
		cout << l << endl;
	else if(test(r) == n)
		cout << r << endl;
	else
		cout << -1 << endl;
	return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);

	long long m;
	cin>>m;

	long long start,end;
	start = 1;
	end=100000000000000000;

	long long  ans = -1;

	while(start<=end){
		long long n = (start+end)/2;

		long long temp = 0;

		for(long long i=2;i<= cbrt(n);i++){
			temp += n/(i*i*i);
		}

		if(temp == m){ans = n;}
		if(temp < m){start = n+1;}else{end = n-1;}
	}

	cout<<ans;

	return 0;
}

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ff              first
#define ss              second
#define pb(x)           push_back(x)
#define mp              make_pair
#define sz(x)           (int)x.size()
#define mem(x ,y)       memset(x , y , sizeof x )
#define all(a )         a.begin() , a.end()
#define endl            "\n"
#define pii             pair<int,int>
#define clr(x)          x.clear()
#define sl(x )          scanf("%I64d" ,&x)
#define sll(x,y )       scanf("%I64d%I64d" ,&x ,&y)
#define si(x )          scanf("%d" ,&x)
#define forn(i ,x,n )   for(int i = x ; i <= n ; i++ )
#define ford(i ,x,n )   for(int i = x ; i >= n ; i-- )
#define rep(i,n )       for(int i= 0; i<n ; i++ )
#define repi(i,n )      for(int i= 1; i<=n ; i++ )
#define repit(i, c)     for( __typeof((c).begin()) i = (c).begin(); i != (c).end();++i )

#ifndef ONLINE_JUDGE
    #define dbg(args...)    do {   cout << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
#else
    #define dbg(args...)   ;
#endif

typedef long long ll  ;
typedef unsigned long long ull  ;

ll  mod =  1e9+7, mod2 = 998244353 ;
int setbit(int n, int pos  ) { return n = n|(1LL<< pos) ; }
int resetbit(int n,int pos ) {  return n =  n & ~(1LL<<pos ); }
bool checkbit(int  n,int pos ) { return (bool ) (n&(1LL<<pos))  ; }
template<typename T> void print(const T& v) {    cerr << v << ' ' ;}
template<typename T>T add(T x, T y, T mod = mod ){ x%= mod ;  y%= mod ;   return (x+y)%mod ;  }
template<typename T>T sub(T x, T y, T mod = mod ){ return ((x-y)%mod+mod )%mod;  }
template<typename T>T mul(T x, T y, T mod = mod ){ x %= mod ; y %= mod ; return (x*y)%mod  ;  }
template<typename T1,typename... T2> void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}
template<typename T> void dbg_a(T a[] ,int n=10 ) {cerr << "[ "; for(int i=0;i <= n ; i++ )cerr<<a[i]<<' ' ; cerr<< " ]" <<  endl; }
template<typename F,typename S>ostream& operator<<( ostream& os, const pair< F, S > & p ){return os << "[ " << p.first << ", " << p.second << " ]";}
template<typename T>ostream &operator<<(ostream & os, const vector< T > &v ){os << "[ "; for(int i=0; i<sz(v) ; i++ )  os << v[i] << ' ' ; return os << " ]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const map< T ,T> &Map ){os << "[ "; repit(it , Map ) os << "[" <<(*it).ff << ' ' << (*it).ss << "] "    ; return os << "]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const set< T > &Set  ){os << "[ "; repit(it , Set ) os <<  *it  << ' ' ; return os << " ]\n" ; }
template<typename T>ostream &operator<<(ostream & os, const multiset< T > &Set) {os << "[ "; repit(it , Set )os <<  *it  << ' ' ; return os << " ]\n" ; }
template<class T> string to_str(T t){stringstream ss; ss<<t; return ss.str();}
// typedef tree<   pair<int,int > ,     // change type
//               null_type,
//               less_equal  <  pair<int,int >  >  ,  // change type ..
//               rb_tree_tag,
//               tree_order_statistics_node_update> ordered_set;
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

template < typename T >
T  bigmod(T x, T k ,T mod = mod) {
    if(k == 0 ) return (T)1;
    if(k&1  ) {
        return ( (x%mod)*bigmod(x,k-1, mod )%mod )%mod ;
    } else {
        T ret = bigmod(x,k/2  , mod ) ;
        ret %= mod ;
        return (ret*ret )%mod;
    }
}
template < typename T >
T  invmod( T x , T m) {
    return bigmod(x,m-2 , m) ;

}
#define  int  ll
const int maxn  = (int)1e6 +123 ;
const ll inf  =  1e18 ; //  0xc0  ; //0x3f ; //
/////////////////////////////////////////////////////

int a[maxn ]  ;

int func(int  mx )  {
    int cnt= 0 ;

    for (int k= 2 ; k*k*k<= mx  ; k++ )
        cnt +=  mx/(k*k*k  )  ;
    return cnt ;
}
void  solve() {
    int  n,m,p, x ,y , z,k ,ans= 0 , tmp  ,  cnt  , mn ,lo,hi ,  mid  ;

    cin >> n  ;
    lo = 0  , hi = 1e16 ;

    while( lo<=hi)  {
        mid=  lo + (hi-lo )/2LL  ;

        x = func( mid ) ;
        if(x<n )  {
            lo = mid +1  ;
        } else {
            ans =  mid ;
            hi = mid-1  ;
        }
    }

    if(func( ans) == n ) cout << ans << endl ;
    else  cout << -1  ;

}
signed main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
           //freopen("out.txt", "w", stdout) ;
    #endif
    ios :: sync_with_stdio(false);  cin.tie(0);  cout.tie(0) ;
    // clock_t st = clock()  ;
    // cout << fixed << setprecision(12) ;
    int  c = 0 ,t = 1  ;
    // cin  >>t ;
    while(t--) {
        solve() ;
    }
    //cerr<<"Execution time : " << (double)(clock()-st )/CLOCKS_PER_SEC << endl ;

    return 0 ;
}

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define maxpq priority_queue<ll>
#define minpq priority_queue<ll, vector<ll>, greater<ll> >
#define vi vector<ll>
#define pii pair<ll, ll>
#define vii vector<pii>
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define MOD 1000000007
#define INT_MAXI 9000000000000000000
#define INT_MINI -9000000000000000000

ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}

const int dx[4] = { -1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

ll func(ll x)
{
	ll ans=0;
	for(ll i=2;i*i*i<=x;i++)
	{
		ans+=(x/(i*i*i));
	}
	return ans;

}

int main()
{
	fio;
	ll k,i,j,m,n=-1;
     cin>>m;

     ll low=1,high=5000000000000000;
     while(low<high)
     {
     	ll mid=(low+high)/2;

     	ll z=func(mid);
     	if(z<m)
     	low=mid+1;
         else
         high=mid;

	 }
	 if(func(low)==m)
	 n=low;
    cout<<n;

}

#include <cstdio>
typedef unsigned long long LL;

const int MAXN = 1e6 + 10;
LL p[MAXN];

inline void init() {
	LL ans = 2;
	for(int i = 0; i < MAXN; ++i) {
		p[i] = ans * ans * ans;
		ans++;
	}
}

int main() {
	LL n; init();
	scanf("%lld", &n);
	LL L = 0, R = 1e16, sum, cnt = -1;
	while(R - L > 1) {
		LL mid = (L + R) >> 1;
		sum = 0;
		for(int i = 0; i < MAXN; ++i) {
			if(mid < p[i] || sum > n) break;
			sum = sum + mid / p[i];
		}
		if(sum >= n) {
			R = mid;
			if(sum == n) {
				cnt = mid;
//				printf("%lld\n", mid);
			}
		}
		else L = mid;
	}
//	printf("%lld %lld\n", sum, L);
	if(cnt > 0) printf("%lld\n", cnt);
	else printf("-1\n");
	return 0;
}

/*
1000000000000000
999999999999999
*/

#include <bits/stdc++.h>

using namespace std;

#define res(x,y) ((x%y)+y)%y
#define rep(x, y) for(int x=0;x<y;x++)
#define sqr(x) x*x
#define scan(x) int x;scanf("%d", &x)

#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(stderr,args)
#else
#define debug(args...)
#endif //ONLINE_JUDGE

#define pb(x) push_back(x)
#define mp(x, y) make_pair(x,y)
#define mod 1000000007

typedef long long ll;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

ll getM(ll n)
{
	ll sum = 0;
	for(ll k=2;k*k*k<=n;k++)
	{
		//printf("debug(%lld) = %lld %lld %lld\n", n, k, k*k*k, n/(k*k*k));
		sum+=(ll)(n/(k*k*k));
	}
	return sum;
}

ll srcN(ll m)
{
	ll min = 7;
	ll max = 8e15;
	ll n = (min+max)/2;
	int found = 0;
	int shouldStop = 0;
	while(!found)
	{
		if (getM(n) > m)
		{
			max = n;
		}
		else if (getM(n) < m)
		{
			min = n;
		}
		else if (getM(n) == m)
		{
			if (getM(n-1) == m)
			{
				max = n;
			}
			else found = 1;
		}
		n = (min+max)/2;
		//debug("%lld %lld %lld %lld %lld\n", min, max, n, getM(n-1), getM(n));
		if (shouldStop == 1 && min+1 == max) {n=-1; break;}
		if (min+1 == max) {shouldStop=1;}
	}
	return n;
}

int main()
{
	ll m;
	cin >> m;
	cout << srcN(m) << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

#ifndef ONLINE_JUDGE
auto __redirect__ = freopen("in", "r", stdin);
#endif

#define ln '\n'
#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

int const N = 2e5 + 16;
int const M = 1e9 + 7;

ll m;

ll count(ll n) {
  ll cnt = 0;

  for(ll i = 2; i <= 1e6; ++i) {
    cnt += n/(i*i*i);

    if(cnt > m)
      return m+1;
  }

  return cnt;
}

int main() {
  scanf("%lld", &m);

  ll l = 8;
  ll r = 8e18;

  ll res = 8e18;

  bool ans = false;

  while(l <= r) {
    ll n = (l+r) >> 1;
    ll c = count(n);

    if(c == m) {
      ans = true;
      res = min(res, n);
      r = n - 1;
    } else if(c < m) {
      l = n + 1;
    } else {
      r = n - 1;
    }

  }

  printf("%lld\n", ans?res:-1LL);
}

#include <cstdio>
#include <iostream>
#include <algorithm>

#define ll long long
#define MAXN 100001
using namespace std;

ll check (ll n) {
    if (n <= 0) return 0;

    ll res = 0;
    for (int i = 2; i <= MAXN; i++) {
      if (i * i * i > n) break;
      else {
        res += n / ((ll)i * i * i);
      }
    }
    return res;
}
int main() {
  ll x;
  scanf("%I64d", &x);
 ll m;
  ll r = 5e16, l = 1;
  while (l <= r) {
    m = (l + r) >> 1;
    ll aa = check (m);
    if (aa >= x) {
      r = m - 1;
    } else if (aa < x) {
      l = m + 1;
    }
  }
  if ( check(l) == x )
  printf("%I64d\n", l);
  else printf("%d\n", -1);

}

#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;
ll n;

bool ch(ll  m){
    ll t = 0;
    for(ll i=2 ; i<=2*1e7; i++){
        ll r= i*i*i;
        if(r > m)
            break;
        t += (1.0*m/r + 0.00000001);
        if(t >= n)return 1;
    }

    return t >= n;
}
bool ch2(ll  m){
    ll t = 0;
    for(ll i=2 ; i<=2*1e7 ; i++){
        ll r= i*i*i;
        if(r > m)
            break;
        t += (1.0*m/r + 0.00000001) ;
        if(t > n)return 0;
    }

    return t == n;
}

ll bin(){
    ll res = -1;
    ll l = 1,h = 1e18;
    while(l <= h){
        ll m = (l+h)/2;
        if(ch(m)){
            res = m;
            h = m-1;
        }
        else{
            l = m+1;
        }
    }
    return res;
}

int main(){
    ios::sync_with_stdio(0);
    cin>>n;
    ll res = bin();
    if(res != -1 && ch2(res)){
        cout<<res;
    }
    else{
        cout<<-1;
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;

ll formas(ll mid){
    ll lim = long(cbrt(mid)), acm=0;
    for(int k=2;k<=lim;k++){
        acm += (mid/(1L*k*k*k));
    }
    return acm;
}

int main(){
    ll m, answ=-1, temp;

    cin >> m;

    ll l=1,r=long(1e16),mid;

    while(l<=r){
        mid = l + (r-l)/2;
        temp = formas(mid);
        if(temp >= m){
            if(temp==m){
                answ = mid;
            }
            r = mid-1;
        }
        else{
            l = mid+1;
        }
    }

    cout << answ <<'\n';

    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define MP make_pair
#define PB push_back
#define N 100009
#define MOD 1000000007
#define f first
#define s second
#define wt(x) cout << # x <<" = " << x << endl
#define FASTIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define inf 1e16
using namespace std;
void read(ll a= 0 )
{freopen("in","r",stdin);       if (a)  freopen("out","w",stdout); }
ll opnum ( ll n )
{

    ll ans = 0 ;
    for (ll i = 2 ; i < N ; i ++ )
    {
        ll op = i * i * i ;

        if ( op > n )break ;
        ll lo = 0 , hi = MOD ;
        while ( lo < hi )
        {
            ll mid = ( lo + hi + 1 ) >> 1 ;
            if ( mid * op <= n )lo = mid ;
            else hi = mid - 1 ;
        }
        ans+= lo ;
    }
    return ans ;
}
int main ()
{

    ll m ;

    cin >> m ;
    ll lo  = 0 , hi = MOD * 100;
    while ( lo < hi )
    {
        ll mid  = ( lo + hi + 1 ) >> 1  ;
        if ( opnum ( mid ) <= m ) lo  = mid ;
        else hi = mid - 1 ;
    }
    ll newlo = 0 , newhi = lo ;
    while (newlo < newhi)
    {
        ll mid = ( newlo + newhi -1 ) >> 1 ;
        if ( opnum ( mid )== m )newhi = mid ;
        else newlo = mid + 1 ;
    }
    ll ans = newhi ;
    if ( opnum ( ans ) == m)cout << ans ;
    else cout << -1 ;

}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
const int mxN = 1e4;

double dr = double(1)/double(3)+0.00000000001;

ll get (ll x) {
	ll ans = 0;
	for (int i=1; i<=mxN; i++) {
		ll nw = pow(x/i, dr);
		ans += nw-1;
		if (nw == 1) break;
	}
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll n, x = 0;
	cin >> n;
	for (ll i=(1ll<<56ll); i>=1; i=(i>>1)) {
		ll cnt = get(i+x);
		if (cnt < n) x += i;
	}
	if (get(x+1) == n) cout << x+1;
	else cout << -1;
	return 0;
}

//Archit Rai
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(a) (int)(a.size())
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define sll(n) scanf("%lld",&n)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define MOD 1000000007
#define endl '\n'
#define PIN(n) printf("%d\n",n)
#define PLLN(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef unsigned long long int ll;
#define N 100010
ll powmod(ll a,ll b)
{
    if(b==0)return 1;
    ll x=powmod(a,b/2);
    ll y=(x*x)%MOD;
    if(b%2)
        return (a*y)%MOD;
    return y%MOD;
}
//Template ends here
ll cube[N];
ll check(ll x)
{
    ll cnt=0;

    REP(i,1,N)
    {
	ll val=x/i;
	if(val==0)
	    break;
	ll j=(upper_bound(cube,cube+N,val)-cube);
	if(j<=1)
	    continue;
	j--;
	cnt+=(ll)(j-1LL);
    }
    return cnt;
}
void pre()
{
    for(ll i=0;i<N;i++)
	cube[i]=i*i*i;
}
int main()
{
    pre();
    ll m;
    scanf("%Lu",&m);
    ll lo=1,hi=ULLONG_MAX-MOD*1LL;
    ll ans=0;
    while(lo<=hi)
    {
	ll mid=lo+(hi-lo)/2;
	if(check(mid)<m)
	    lo=mid+1;
	else if(check(mid)>=m)
	{
	    ans=mid;
	    hi=mid-1;
	}
    }
    if(ans!=0 && check(ans)==m)
	printf("%Lu\n",ans);
    else
	printf("-1\n");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long m,l=8,u;
    cin>>m;
    u=8*m+1;
    while(l<u)
    {
        long long n=(l+u)/2,c=0;
        for(int k=2;k*k*k<=n;k++)
        c+=(n/(k*k*k));
        if(c==m)
        {
            cout<<n<<endl;
            return 0;
        }
        else if(c<m)
            l=n+1;
        else
            u=n;
    }
    cout<<"-1\n";
    return 0;
}

#include <iostream>
using namespace std;
long long m;
int calc(long long n) {
	long long k;
	long long ago = 0;
	for (k = 2; k <= 100000; k++) {
		long long v = n / k / k / k;
		ago += v;
		if (ago > m || ago < 0) {
			return m + 1;
		}
		if (v == 0)break;
	}
	return ago;
}
void solve() {
	long long x = 0;
	long long y = 1000000000000000000L;
	long long mid;
	while (x < y) {
		mid = (x + y) / 2;
		long long v = calc(mid);
		if (v >= m) {
			y = mid;
		}
		else {
			x = mid + 1;
		}
	}
	mid = calc(x);
	if (mid == m)printf("%lld\n", x);
	else printf("-1\n");
}
int main()
{
	while (scanf("%lld", &m) != EOF) {
		solve();
	}
	return 0;
}

/*
7,14,28,56
1,4,16,64
2,8,32,128
3,9,27,81
4,12,36,108
5,15,75,225
8,16,32,64*/

#include <bits/stdc++.h>
using namespace std;

long long calculate(long long x) {
// 	cerr << x << ": " << endl;
	long long rs = 0;
	for(long long i = 2; i <= 1e5; i++) {
		long long a = x / (i * i * i);
		rs += a;
// 		cerr << rs << endl;
	}
// 	cerr << rs << endl;
	return rs;
}

int main() {
	ios_base::sync_with_stdio(0);
	long long m;
	cin >> m;

	long long s = 2;
	long long t = 9 * 1e15;
	long long ans = -1;
	while(s < t) {
		long long mid = (s + t) / 2;
		long long rs = calculate(mid);
		if(rs < m) {
			s = mid + 1;
		} else if(rs >= m) {
			t = mid;
		}
	}
	ans = (s + t) / 2;
	if(ans != -1 && calculate(ans) == m) {
		cout << ans;
	} else {
		cout << -1;
	}

}

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
ull func(ull n)
{
    ull ans = 0,i;
    for (i = 2; (i*i*i) <= n ; i++)
        ans += (n/(i*i*i));
    return ans;
}
int main(){
    ull n;
    cin>>n;
    ull x,mid,a=0,b = pow(10,15);
    while(a < b){
        mid = a + (b-a)/2 ;
        x = func(mid);
        if(x < n)
            a= mid + 1;
        else
            b = mid;
    }
    if(func(a) == n){
        cout<<a<<endl;
        return 0;
    }
    cout<<-1<<endl;
    return 0;
}

#include <bits/stdc++.h>
//#define _ ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;

#define pof pop_front
#define mp make_pair
#define all(a) a.begin(),a.end()
#define bitcnt(x) __builtin_popcountll(x)
#define MOD 1000000007
#define total 5000005
#define Me 1000000000001
#define NIL 0
#define MAXN 210005
#define EPS 1e-5
#define INF (1<<28)
#define pi 3.141593

vector<long long > vec;
int main(){
int n;
for(int i=2;i<=100009;i++)vec.push_back(1ll*i*i*i);
cin>>n;
long long  l=1;
long long r=100000000000000;
long long ans=-1;
while(r-l>=0){
    long long mid=l+(r-l)/2;
    long long cur=0;
    for(long long int i=0;i<=100000;i++){
            if(mid/vec[i] ==0 || cur>n)break;
            cur+=mid/vec[i];

    }//cerr<< mid<< " "<<cur<<" \n";
    if(cur==n){if(ans==-1)ans=mid;
    else ans=min(ans,mid);}
        if(cur>=n)r=mid-1;
    else l=mid+1;

}
//cerr<<(1+lower_bound(vec.begin(),vec.end(),27)-vec.begin())<<"* "<<(1+lower_bound(vec.begin(),vec.end(),64)-vec.begin())<<"* ";
//cerr<<l<<" "<<r;
cout<<ans;

}

//In The Name of Beauty

//harchi bood gozasht faghat jaye zakhmesh moond
//minevisam o minevisam o bala mire gardesh khoon
//rozio mibinam jori halam khoobe ke chasbidam be saghf
//oon rooz age mano didi faghat begoo haghesh bood...
//YAS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef map<ll,ll> mllll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define F first
#define S second
#define trvall(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define MAXN (ll)1e5 + 8
#define INF  (ll)1e12 + 8
ll const delta = 1000000007;

ll pow3[MAXN];

void pre()
{
    for(ll i = 1;i < MAXN;i++)
    {
        pow3[i] = i * i * i;
    }
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    pre();
    ll l = 0 , r = MAXN - 1,mid = l + ((r - l) / 2);
    while(r - l > 1)
    {
        ll temp = 0;
        ll j = 2;
        while(mid / pow3[j] > 0)
        {
            temp += (mid / pow3[j]);
            j++;
        }
        if(temp >= n)r = mid;
        else l = mid;
        mid = l + ((r - l) / 2);
    }
    ll ans1 = 0 , ans2 = 0,ans3 = 0;
    for(ll i = 2;i < MAXN;i++)
    {
        ans1 += (l / pow3[i]);
        ans2 += (mid / pow3[i]);
        ans3 += (r / pow3[i]);
        if(mid / pow3[i] < 1 && l / pow3[i] < 1 && r / pow3[i] < 1)break;
    }
    if(ans1 == n)cout << l;
    else if(ans2 == n)cout << mid;
    else if(ans3 == n)cout << r;
    else cout << -1;
    return 0;
}
//Written by M_H_H_7

/*NAME: SANYAM GARG
INSTITUTION:DELHI TECHNOLOGICAL UNIVERSITY*/
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#define mod 1000000007
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s",&x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 2000000000000000000

using namespace std;

int main()
{
	li m,low,high,p,i,mid;
	readl(m);
	low=1;
	high=2000000000000000;
	ll flag=0;
	while(low<=high)
	{
		mid=(low+high)>>1;
		p=0;
		for(i=2;i<=200000;i++)
		{
			p+=((mid)/(i*i*i));
		}
		if(p==m)
		{
			flag=1;
				p=0;
		for(i=2;i<=200000;i++)
		{
			p+=((mid-1)/(i*i*i));
		}
		if(p<m)
		{
			break;
		}
		}
		if(p<m)
		{
			low=mid+1;
		}
		else
		{
			high=mid-1;
		}
	}
	if(flag)
	cout<<mid;
	else
	cout<<"-1";

}

// Problem : C. Mike and Chocolate Thieves
// Contest : Codeforces - Codeforces Round #361 (Div. 2)
// URL : https://codeforces.com/problemset/problem/689/C
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cerr << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cerr << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin() , (x).end()
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
ll m;

ll check(ll mid){
	ll sum = 0;
	for(ll i = 2 ; i <= max_n ; i++){
		if((i * i * i) > mid)break;
		sum += (mid)/(i * i * i);
	}

	return m - sum;
}

int main()
{
		cin >> m;

		ll beg = 1 , last = 1e15 , mid , ans = -1;
		while(beg <= last){
			mid = beg + (last - beg) / 2;

			// debug(mid);
			ll res  = check(mid);
			if(res == 0){
				ans = mid;
				last = mid - 1;
			}
			else if(res < 0){
				last = mid - 1;
			}
			else beg = mid + 1;
		}

		cout << ans << "\n";
    return 0;
}

#include <stdio.h>

long long check(long long);
long long check(long long n)
{
    long long minn = 0;
    for(long long k = 2;k * k * k <= n;k++)
        minn += n / (k * k * k);
    return minn;
}
int main()
{
    long long m,l = -1,r = 1e18,mid;
    scanf("%I64d",&m);
    while(r >= 1)
    {
        mid = (l + r) / 2;
        static long long num = check(mid);
        if(num >= m)
            r = mid;
        else
            l = mid + 1;
    }
    printf("%I64d",l);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define LL long long
LL n;
LL solve(LL x){
    LL ans=0;
    for(LL i=2;i<=100000&&i*i*i<=x;i++){
        ans+=x/(i*i*i);
    }
    return ans;
}
LL ddd(){
    LL l=1,r=1LL<<62;
	while(l<r){
        LL mid=(l+r)>>1;
        if(solve(mid)>=n) r=mid;
        else l=mid+1;
        if(l==r-1){
            if(solve(l)==n)
                return l;
            else if(solve(r)==n)
                return r;
            return -1;
        }
	}
	return l;
}
int main() {
	cin>>n;
	cout<<ddd()<<endl;
	return 0;
}

#include <iostream>

using namespace std;

int K = 100000;
long long M;

long long find_number(long long N){
  long long counter = 0;
  for(long long i=2;i<K;i++)
      counter += N / (i*i*i);
  return counter;
}

int main(){
  cin >> M;
//  cout << M << endl;
  long long first = 1, last = 1000000000000;
  while(first +1 < last){
      long long middle = (first+last) / 2;
      long long ctr = find_number(middle) ;
      //cout << "first -> " << first << "\nlast -> " << last << "\nres -> " << ctr << endl;
      if(ctr >= M)
        last = middle;
      else
        first = middle;
  }
  // if(find_number(first) == M)
  //   cout << first << ' ' << find_number(first) << endl;
  // else if(find_number(last) == M)
  //   cout << last << ' ' << find_number(last) << endl;

  if(find_number(first) == M)
    cout << first << endl;
  else if(find_number(last) == M)
    cout << last << endl;
  else
    cout << -1 << endl;
  return 0;
}

#define _USE_MATH_DEFINES//M_PI
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
const ll infll = powl(2, 62)-1;
//const int mod = pow(10, 9) + 7;

int ways(int n) {//returns number of ways in O(n^(1/3))
    int count = 0, upper = cbrt(n);
    for(int b = 2; b <= upper; b++) {
        count += n/(b*b*b);
    }
    return count;
}

int32_t main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int start = 1, end = n, mid;
    while(start < end) {
        mid = (start+end)/2;
        if(ways(mid) <= n) {
            start = mid+1;
        } else {
            end = mid-1;
        }
    }
    //cout << "here " << mid << endl;
    mid = max(mid-2, 0ll);
    int temp = ways(mid);
    while(temp <= n) {
        if(temp == n) {
            cout << mid << endl;
            return 0;
        }

        if(temp > n) {
            cout << -1 << endl;
            return 0;
        }
        mid++;
        temp = ways(mid);
    }
    cout << -1 << endl;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define pb push_back
#define mp make_pair
#define mem(x) memset(x, 0, sizeof(x))

const ll inf=1e18;
const int mod=1e9+7;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
ll chck(ll n) {
	ll ans = 0;
	for(ll i = 2; i*i*i <= n; i++) {
		ans += n/(1ll*i*i*i);
	}
	return ans;
}
int main(){
    ll m,ans = -1;
    cin>>m;
    ll l = 0, r = 1e15+10;
    while(l < r) {
		ll mid = l + (r - l) / 2;
		if(chck(mid) < m) l = mid + 1;
		else r = mid;
	}
	if(chck(l) == m) ans = l;
	cout<<ans<<endl;

return 0;
}

#include <bits/stdc++.h>

using namespace std;

long long count(long long n)
{
    long long sum = 0;
    for (long long k = 2; k * k * k <= n; k++)
    {
        sum += (n / (1ll*k*k*k));
        //cout << sum << " " << k << endl;
    }
    return sum;
}

int main()
{
    long long m;
    cin >> m;
    long long l = 1, r = 1000000000000000;
    while (l < r)
    {
        long long mid = (l + r) / 2;
        long long cnt = count(mid);
        //cout << mid << " " << cnt << endl;
        if (cnt >= m) {
            r = mid;
        } else {
            l = mid + 1;
        }
    }

    if (count(l) == m) cout << l << endl;
    else cout << "-1" << endl;
}

#define fi freopen("../../../../../Desktop/input.txt", "r", stdin);
#define fo freopen("../../../../../Desktop/output.txt", "w", stdout)
#define fio fi fo
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
#define   max(a,b)     (a>b?a:b)
#define   min(a,b)     (a>b?b:a)
#define INF 99999999
typedef long long int ll;

int n;
vector< ll >vi;

void pre() {
	for (int i = 1; i*i*i*1LL < 1005; i++)
		for (int j = 2; j*1LL < 1005; j++)vi.push_back(i*(j*j*j*1LL));
	sort<vector<ll>::iterator>(vi.begin(),vi.end());
}

int main()
{
	//fio;

	pre();
	cin >> n;

	//for (int i = 0; i < vi.size(); i++)cout << vi[i] << " ";
	cout << "d";
	n--;

	if (n == 0)cout << vi[0];
	else {

		if (vi[n - 1] == vi[n] | vi[n] == vi[n + 1])cout << -1;
		else cout << vi[n];

	}
	//cin >> n;
	return 0;
}

/* author   : mpily :-()
title : Competing.cpp
time :Sun Jun 14 13:11:23 2020

*/
#include<random>
#include<cassert>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<utility>
#include<cstdint>
#include<queue>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdio>
//4611686018427387903

using namespace std;
bool check(int64_t n,int64_t targ){
	int64_t ans = 0;
	for(int64_t i = 2; i <= 100000; ++i){
		ans+=n/(i*i*i);
		if(ans >= targ)
			return true;
	}
	if(ans >= targ)
		return true;
	return false;
}
void solve(int cnum){
	int64_t m;
	cin >> m;
	int64_t low = 1;
	int64_t high = 1e10;
	while(low < high){
		//cout << low << " "<<high<<"\n";
		int64_t mid = low + (high-low)/2;
		if(check(mid,m)){
			high = mid;
		}
		else{
			low = mid+1;
		}
	}
	int64_t nm = 0;
	for(int64_t i = 2; i <= 100001; ++i){
		nm += low/(i * i * i);
		//cout << i << "has "<<low/(i*i*i)<<" options\n";
	}
	if(nm == m)
		cout << low <<" \n";
	else
		cout << -1 << "\n";

}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//cout.tie(nullptr);
	int t;
	int count = 1;
	for(t = 1;t--; solve(count),count++);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, K)
#define ffa ffi ffj
#define s <<" "<<
#define w cout
#define e endl
#define pb push_back
#define mp make_pair
#define a first
#define b second
#define int ll
//500,000,000 operations
//Global Variables
int M, mid, ways;

void calc() {
    ways = 0;
    For (i, 2, 100001) {
        ll big = i*i*i;
        if (mid >= big) {
            ways += (int)(mid/big);
            //w<< mid/big<<e;
        }
        else break;
    }
}

main() {
    //ifstream cin ("test.in");
    cin >> M;

    int a = 1;
    int b = 100000;
    while (a < b) {
        mid = (a+b)/2;
        calc();
        //w<< a s b s mid<<e;
        if (ways > M) b = mid;
        else if (ways < M) a = mid+1;
        else b = mid;

    }
    if (ways != M) a = -1;
    w<< a <<e;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll ways(ll N)//ways for a capacity
{
    ll ans = 0;
    for(ll i = 2; i*i*i <= N; ++i)
    {
        ans += N/(i*i*i);
    }
    return ans;
}

int main()
{
    ll m;
    cin >> m;

    ll l = 0, h = 1e18 + 7, ans = -1;

    while(l <= h)
    {
        ll cap = l + (h-l)/2, cnt = ways(cap);

//        cout << "cap " << cap<<endl;
        if(cnt == m) ans = cap;

        if(cnt > m) h = cap - 1;
        else l = cap + 1;
    }
    printf("%I64d", ans);

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <bitset>
#include <cstdio>
#include <sstream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <cctype>
#include <iomanip>
#include <list>
#include <cstring>

#define INF 2000000000
#define ull unsigned long long int
#define vi vector<int>
#define vii vector<ii>

#define UNVISITED 0
#define OPENED 1
#define CLOSED 2

#define NBNODE 2000

using namespace std;

int tab[200100];
int visited[200100];

long long int cube(long long int a) {
    return a*a*a;
}

long long int fct(long long int a) {

    long long int res = 0;

    for(int i= 2; cube(i) <= a; i++) {

     //   cout << res << " " << i << " "<< cube(i) << endl;
        res+= a/cube(i);

    }
    return res;
}

int main () {

    long long int m;
    cin >> m;

    long long int borneInf = 1;
    long long int borneSup = 9000000000000000;
    long long int milieu = (borneInf+borneSup)/2;

    bool ok = false;

    while(borneSup > borneInf+1) {

        long long int res= fct(milieu);
     //   cout << milieu << " " <<  res << endl;
        if(res > m) borneSup = milieu-1;
        if(res < m) borneInf = milieu+1;
        if(res == m) {
            ok = true;
            borneSup = milieu-1;
        }

        milieu = (borneInf+borneSup)/2;
    }

    while(fct(milieu) < m) {
       milieu++;
    }
    while(fct(milieu) > m ) {
        milieu--;
    }

    if(ok) cout << milieu << endl;
    else cout << -1 << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
//TO FAZENDOE SSE PORRA

typedef long long ll;

ll binary (ll mid){
    ll i=2, possibilities = 0;
    while (i*i*i <= mid){
        possibilities += mid/(i*i*i);
        i++;
    }

    return possibilities;
}

int main (){
    ll m, min, max;
    scanf ("%l64d", &m);

    min = -1;
    max = INT_MAX;
    while (max>min+1){
        ll mid = (min+max)/2;

        if (binary (mid) >= m){
            max = mid;
        } else {
            min = mid;
        }
    }

    if (binary(max)==m){
        printf ("%l64d\n", max);
    } else {
        printf ("-1\n");
    }

    return 0;
}

#include<bits/stdc++.h>
#define NN 100100
using namespace std;
typedef long long INT;
INT power[NN];
void no(){
	for(int i=1;i<NN;i++){
		power[i]=(INT)i*i*i;
	}
}
INT calc(INT A){
	INT cnt=0;
	for(int i=2;i<NN;i++){
		if(power[i]<=A)cnt+=A/power[i];
		else break;
	}
	return cnt;
}
int main(){
#ifndef ONLINE_JDUGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	no();
	INT m;
	scanf("%lld",&m);
	INT st=0,ed=9223372036854750000LL,mid;
	while(ed-st>1){
		mid=(st+ed)/2;
		if(calc(mid)>=m) ed=mid;
		else st=mid;
	}
	if(calc(ed)==m)  printf("%I64d",ed);
	else puts("-1");

	return 0;
}

#include<bits/stdc++.h>
#define NN 100100
using namespace std;
typedef long long INT;
INT power[NN];
void no(){
	for(int i=1;i<NN;i++){
		power[i]=(INT)i*i*i;
	}
}
INT calc(INT A){
	INT cnt=0;
	for(int i=2;i<NN;i++){
		if(power[i]<=A)cnt+=A/power[i];
		else break;
	}
	return cnt;
}
int main(){
#ifndef ONLINE_JDUGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	no();
	INT m;
	scanf("%lld",&m);
	INT st=0,ed=9223372036854750000LL,mid;
	while(ed-st>1){
		mid=(st+ed)/2;
		if(calc(mid)>=m) ed=mid;
		else st=mid;
	}
	if(calc(ed)==m)  printf("%lld",ed);
	else puts("-1");

	return 0;
}

#include <bits/stdc++.h>
#include <iomanip>

#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define initarr(a,n,x) for (int i=0;i<n;++i) a[i]=x
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.insert(tmp);commands}
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

#define ll long long
#define ld long double
#define pii std::pair<int, int>
#define pll std::pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi >
#define vii vector<pii >

pii operator+(pii a, pii b)
{
    return {a.fi+b.fi,a.se+b.se};
}
pll operator+(pll a, pll b)
{
    return {a.fi+b.fi,a.se+b.se};
}
std::ostream& operator<<(std::ostream& out,pii a)
{
    out<<a.fi<<" "<<a.se<<endl;
    return out;
}
std::ostream& operator<<(std::ostream& out,pll a)
{
    out<<a.fi<<" "<<a.se<<endl;
    return out;
}
std::istream& operator>>(std::istream& in,pii &a)
{
    in>>a.fi>>a.se;
    return in;
}
std::istream& operator>>(std::istream& in,pll &a)
{
    in>>a.fi>>a.se;
    return in;
}

using namespace std;
ll check(ll m,ll ans)
{
    ll t=0;
    for (ll int k = 2; k < 1e5; ++k)
    {
        t+=ans/(k*k*k);
    }
    if(t==m)
        return 2;
    if(t>m)
        return 1;
    else return 0;
}
int main()
{
    //FAST;
    ll int m;
    cin>>m;
    ll low=8,high=2e15,mid;
    while(high-low>1)
    {
        mid=low+(high-low)/2;
        if(check(m,mid))
        {
            high=mid;
        }else{
            low=mid+1;
        }
    }
    if(check(m,low)==2)
        cout<<low;
    else if(check(m,high)==2)
        cout<<high;
    else cout<<-1;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>

using namespace std;

int check(int n) {
    int sum = 0;
    for(int x=2;x * x * x <= n;x++)
        sum += n / (x*x*x);
    return sum;
}

int main() {

    long int m;

	cin >> m;

	long long int lo=0;
	long long int hi= 1LL << 61;
	long long int mid;

    while(lo<=hi) {
        mid = (hi+lo)/2;
        if(check(mid)>=m)
            hi = mid - 1;
        else
            lo = mid + 1;
    }
    //cout << mid << " " << check(mid) << endl;
    if(check(mid)!=m)
        cout << "-1" << endl;
    else
        cout << mid << endl;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define N 200005
#define ll long long
ll n,m;

ll judge(ll x)
{
    ll ans = 0;
    for(ll i = 2;i < 100000;i ++)
    {

        ll p = i*i*i;
        ans += (x/p);
    }
    return ans;
}
int main()
{
    scanf("%I64d",&m);
    ll l = 1,r = 100000000000000000;
    while(l <  r)
    {
        ll mid = (l+r) / 2;
        if(judge(mid) >= m)
        {
            r= mid;
        }
        else
        {
            l = mid+1;
        }
    }
    if(judge(r) == m)
    {
      //  printf("%lld\n",judge(r));
        printf("%I64d\n",r);
    }
    else
        printf("-1\n");
}

#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<iostream>

using namespace std;

long long int n,m,k,q=0,d,a[100000];
long long mini=90000000000000000;

void binarna(long long poc,long long kraj,long long m)
{
    long long ni;

    if(poc<kraj)
    {
        ni=(poc+kraj)/2;
        long long brm=0;
        for(long long i=2;i*i*i<=ni;i++)
        {
            brm+=ni/(i*i*i);
        }
        if(brm==m) { if(ni<mini) mini=ni; q=1; binarna(poc,mini,m); }
        else if (brm<m) binarna(ni+1,kraj,m);
        else if (brm>m) binarna(poc,ni-1,m);
    }
}

int main()
{
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    cin>>m;

    n=-1;

    binarna(1,10000000000000000,m);

    if(q==1) n=mini;

    cout<<n;
    /*1 2 4 8
    2 4 8 16
    3 6 12 24
    4 8 16 32
    5 10 20 40
    6 12 24 48
    1 3 9 27
    2 6 18 54*/
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

typedef long long int NUMBERTYPE;

NUMBERTYPE howManyK(NUMBERTYPE n) {
    return ceil(pow(n,(1.0/3.0)));
}

NUMBERTYPE howManyA(NUMBERTYPE n, NUMBERTYPE K){
    //if(n == 64) cout << K << " " << ( ((double) n) / ((double) pow(K,3)) ) << endl;
    return ( ((double) n) / ((double) pow(K,3)) );
}

NUMBERTYPE find_N_given_A_and_K(NUMBERTYPE a, NUMBERTYPE k){
    return a*k*k*k;
}

NUMBERTYPE binarySearch(NUMBERTYPE input){

    NUMBERTYPE min = 1, max = 1000000000000000, middle;
    NUMBERTYPE temp_answer, answer = -1;

    while(min < max)
    {
        temp_answer = 0;
        middle = (min+max) >> 1;

        for(NUMBERTYPE a = 2; a <= howManyK(middle); a++)
            temp_answer += howManyA(middle,a);

        //cout << min << " " << middle << " " << max << " " << temp_answer << " " << answer << " " << input << endl;

        if(answer < 0){
            if(temp_answer > input){
                max = middle - 1;
            }

            else if(temp_answer < input){
                min = middle + 1;
            }

            else {
                min = middle - 2;
                max = middle;
                answer = middle;
            }
        }

        else {
            if(temp_answer == input){
                min = middle - 2;
                max = middle;
                answer = middle;
            }
            else min = max;
        }
    }

    return answer;

}

int main() {
    NUMBERTYPE input;

    cin >> input;

    cout << binarySearch(input);

	return 0;
}

// 1493855906576

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int n;
long long lo, hi;

long long f( long long x ) {

	long long ret = 0;

	int i = 2;

	while ( i * i * i <= x ) {
		ret += ( x / ( i * i * i ) );
		i += 1;
	}

	return ( ret );

}

int main( ) {

	scanf( "%d", &n );

	lo = 0;
	hi = 1e5;

	while ( lo < hi ) {

		long long mid = ( lo + hi ) / 2;

		if ( f(mid) < n ) {
			lo = mid+1;
		}else {
			hi = mid;
		}

	}

	if ( f(lo) != n ) {
		printf( "-1\n" );
	}else {
		cout << lo << endl;
	}

	return 0;

}

//       <............ be name khoda ..............>
#include<bits/stdc++.h>
using namespace std;
#define int long long
int m;
int iin(){
	int x;
	cin >> x;
	return x;
}
const int N =  1e6;
int x[ N + 1 ];
int check(int n){
	int ans = 0;
	for(int i = 2;i*i*i <= n; i++)
		ans += (int)n/x[ i ];
	return ans;
}
main(){
	for(int i = 2;i <= N; i++) x[ i ] = pow( i, 3);
	m = iin();
	int l = 1, r = 1e18;
	while( r - l > 1 ){
		int mid = ( l + r )/2;
		int c = check(mid);
		int ans = 0;
		if( c >= m )
			r = mid;
		else l = mid;
	}
	if( check( l ) == m ) cout << l <<endl;
	else
	if( check( r ) == m ) cout << r <<endl;
	else cout << -1 <<endl;
}

#include "map"
#include "queue"
#include "math.h"
#include "stdio.h"
#include "string.h"
#include "iostream"
#include "algorithm"
#define abs(x) x > 0 ? x : -x
#define max(a,b) a > b ? a : b
#define min(a,b) a < b ? a : b

using namespace std;

int main()
{
    int n,ans;
    scanf("%d",&n);
    if(n==1)
        ans=8;
    else if(n==8)
        ans=54;
    else if(n==27)
        ans = 152;

    else
        ans = -1;
    printf("%d\n",ans);
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>

#define VAR(TYPE, NAME) TYPE NAME##1; TYPE NAME##2; TYPE NAME##3; TYPE NAME##4;TYPE NAME##5;
#define lli long long int

int main()
{
	lli m;
	lli low = 8, high = 91;
	lli best_n = 0x7FFFFFFFFFFFFFFF;
	lli mid;
	lli count;
	lli start, k;
	lli B, B1;
	bool end;
	scanf("%lld", &m);

	mid = high / 2;
	do
	{
		count = 0;
		end = true;
		for (start = 1; end; ++start) {
			end = false;
			k = 2;
			while(true) {
				B = start;
				if (B > mid)
					break;
				B1 = B * k;
				if (B1 > mid || B > B1)
					break;
				B = B1;
				B1 = B * k;
				if (B1 > mid || B > B1)
					break;
				B = B1;
				B1 = B * k;
				if (B1 > mid || B > B1)
					break;
				++count;
				end = true;
				if (count > m) {
					end = false;
					break;
				}
				++k;
			}
		}
		if (count < m) {
			low = mid + 1;
		}
		else if (count > m) {
			high = mid - 1;
		}
		else if (best_n > mid) {
			best_n = mid;
			high = mid - 1;
		}
		mid = (low + high) / 2;
	} while (low <= high);
	if (best_n == 0x7FFFFFFFFFFFFFFF) {
		printf("-1\n");
	}
	else {
		printf("%lld\n", best_n);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll f(ll n){
	ll ans=0;
	ll i=2;
	while((n/pow(i,3))>=1){
		//cout<<n;
		ans+=(n/pow(i,3));
		i++;
	}
	return ans;
}
int main(){
	ll m;
	cin>>m;
	ll l=0;ll r=(8*m)+1;
	while(l!=(r-1)){
		//cout<<"SHIT";
		ll temp=f((l+r)/2);
		if(temp>m) {
			r=((l+r)/2);
		}
		else if(temp<m){
			l=((l+r)/2);
		}
		else{
			cout<<(l+r)/2;
			return 0;
		}
	}
if(f(l)==m){
	while(f(l)==m){
		l--;
	}
	cout<<l+1;
}
else if(f(r)==m) cout<<r;
else cout<<-1;

}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll valid(ll m){
ll sum=0;
for(ll i=2;i<=1e6+1e3;i++)sum+=(m/(i*i*i));

return sum;
}
int main(){
ll m=1000000000000000,n=-1;
ll l=0,r=1e16;
while(l<=r){
ll mid=(l+r)/2;
ll o=valid(mid);
if(o<m)l=mid+1;
else r=mid-1,n=(o==m?mid:n);
}
if(valid(n)==m)cout<<n;else cout<<-1;

    return 0;
}

//       <............ be name khoda ..............>
#include<bits/stdc++.h>
using namespace std;
#define int long long
int m;
int iin(){
	int x;
	scanf("%I64d",&x);
	return x;
}
const int N = sqrt(sqrt(1e18))+1;
int x[ N ];
int check(int n){
	int ans = 0;
	for(int i = 2;i < N; i++)
		ans += n/x[ i ];
	return ans;
}
main(){
	for(int i = 2;i < N; i++) x[ i ] = pow( i, 3);
	m = iin();
	int l = 1, r = 1e18;
	while( r - l > 1 ){
		int mid = ( l + r )/2;
		int c = check(mid);
		if( c >= m ){
			r = mid;
		}
		else l = mid;
	}
	if( check( r ) == m ) cout << r <<endl;
	else cout << -1 <<endl;
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<queue>
#include<math.h>
#include<map>
#define INF 0x3f3f3f3f
#define MAX 1e15
#define Temp 1000000000
#define MOD 1000000007

using namespace std;

long long n;

long long Check(long long m)
{
    long long ans=0;
    for(long long i=2;i*i*i<=m;i++)
    {
        ans+=(m/(i*i*i));
    }
    return ans;
}

long long Find()
{
    long long L=1,R=MAX,ans=MAX;
    while(L<R)
    {
        long long Mid=(L+R)/2;
        long long t =Check(Mid);
        if(t >= n)
            R=Mid;
        else if(t < n)
            L=Mid+1;
        if(t==n)
            ans=min(ans,Mid);
    }
    if(Check(L) == n)
        ans=min(ans,L);
    return ans;
}

int main()
{
    while(scanf("%lld",&n)!=EOF)
    {
        long long ans=Find();
        if(ans==MAX)
            printf("-1\n");
        else
            printf("%lld\n",ans);
    }
    return 0;
}

#include <iostream>
#include <cmath>

using namespace std;
typedef long long ll;
int main(){
    ll m;
    cin >> m;
    ll low = 1, high = 1e17, mid = (high-low)/2;
    ll answ = 9999999999999999;
    while(low-high!=1){
       // cout << low << " " << high << endl;
        ll pot = 0;
        for(int i = 2; i <= 1e5; i++){
            pot+= mid/(pow(i,3));
        }
        if(pot < m){
            low = mid+1;
            mid = low + (high-mid)/2;
        }else if( pot == m){
            answ = min(answ,mid);
            high = mid-1;
            mid = low+ (high-mid)/2;
        }else {
            high = mid-1;
            mid = low+ (high-mid)/2;
        }
    }
    if(answ == 9999999999999999)answ=-1;
    cout << answ;

    return 0;
}

#include <bits/stdc++.h>
#define MAX 1010101
#define INF 2020202020
#define MOD 1000000007
#define ll long long
#define pb push_back
using namespace std;

ll m;

int main ()
{
	ios_base::sync_with_stdio ( 0 );
	//freopen ( "input", "r", stdin );

	cin >> m;

	ll l = 0, r = INF*1000000000ll;

	while ( r - l > 1 )
	{
		ll n = ( l + r ) >> 1ll;
		ll cnt = 0;

		for ( ll i = 2; i <= 200000; ++ i )
		{
			cnt += n/pow(i,3ll);
		}

		if ( cnt >= m ) r = n-1;
		else l = n;
	}

	ll n = l;
	ll cnt = 0;
	for ( ll i = 2; i <= 200000; ++ i )
		cnt += n/pow(i,3ll);

	if ( cnt == m ) cout << n << endl;
	else
	{
		n = r;
		cnt = 0;
		for ( ll i = 2; i <= 200000; ++ i )
		cnt += n/pow(i,3ll);
		if ( cnt == m ) cout << n << endl;
		else cout << -1 << endl;
	}

	return 0;
}

#include <bits/stdc++.h>
#define MAX 200005
#define inf 1000000000000000000
#define ll long long
#define MOD 1000000007
#define s(x) scanf("%d", &x);

using namespace std;

ll check(ll mid) {
    ll answer = 0;
    for(int i = 2; i <= 100000; i++) {
        ll x = mid;
        x/=i;
        x/=i;
        x/=i;
        answer+=x;
    }
    return answer;

}
int main() {
    ll n ;
    cin >> n;
    ll low = 0;
    ll high = inf;
    while(low <= high) {
        ll mid = (low + high)/2;
        ll lowww = check(mid);
       // cout << mid <<" " << low << " " << high <<" " <<" " << lowww<<  endl;
        if( lowww>= n) {
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }
    int start = max(low - 100, 1LL);
    int end = low + 100;
    int flag = 0;
    for(int i = start ; i <= end; i++) {
        if(check(i) == n) {
            flag = 1;
            cout << i << endl;
            break;
        }
    }
    if( flag == 0) {
        cout << -1 << endl;
    }
}

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;

long long m;

long long fun(long long k){
	long long res = 0;
	for (long long i = 2; i*i*i <= k; i++){
		res += k / (i*i*i);
	}
	return res;
}

int main(){
	//freopen("input.txt", "r", stdin);
	cin >> m;
	long long l = 1, r = 1000000000000001;
	while (r>l){
		long long c = l + (r - l) / 2;
		long long t = fun(c);
		if (t >= m){
			r = c;
		}
		else {
			l = c + 1;
		}
	}
	(fun(r) == m) ? cout << r : cout << -1;
	return 0;
}

  #include<bits/stdc++.h>
  using namespace std;

  ifstream fin("input.in");
  long long m, ans = 0, curr = 8, cube;

long long findmax(long long n){
  long long ans = 0;
  for(long long i = 2; i <= cbrt(n); i++){
    cube = pow(i,3);
    ans += n/cube;
  }
  return ans;
}

int main() {
  cin >> m;
  long long lefty = 0, righty = 1000000000000000, mid;
  while(lefty < righty){
    mid = (lefty+righty)/2;
    if(findmax(mid) < m){
      lefty = mid+1;
    }else{
      righty = mid;
    }
  }
  if(findmax(righty) == m){
    cout << righty << endl;
  }else{
    cout << -1 << endl;
  }
}

#include <bits/stdc++.h>
#include <fstream>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

double Fib(double x,double z);
string BinDec(ull x);
string StringInt(ll x);
ull StringInt(string x);
ull BinDec (string x);
ull POWMOD (ull x,ull y,ull mod);
ull POWE(long long , long long);

struct trie
{
    trie *child[2];
    int one,zero,is;
    trie()
    {
        memset(child,0,sizeof(child));
        one=zero=is=0;
    }
    void insert (char *str)
    {
        if(*str==0)is=1 ;
        else{
               // cout<<*str;
        int in=(*str)-'0';
        if(in==0)zero++;
        else if(in==1)one++;
        if(child[in]==0)
            child[in]=new trie();
        child[in]->insert(str+1);
        }
    }
    void remove(char *str)
    {
        if(*str==0)is=0;
        else{
        int in=*str-'0';
        if(in==0)zero--;
        if(in==1)one--;
        if(child[in]==0)
            child[in]=new trie();
        child[in]->remove(str+1);

        }
    }
    void get(char *str,ll & a,ll b)
    {
      //  cout<<a<<' '<<b<<endl;
        if(*str==0);
        else{
        int in=*str-'0';
        if(in==0&&one>=1)
        {
            a+=b;
            child[1]->get(str+1,a,b/2);
        }
        else if(in==1&&zero>=1)
        {
            a+=b;
            child[0]->get(str+1,a,b/2);
        }
        else
        child[in]->get(str+1,a,b/2);
        }
    }

};

ll x;

int c(ll m)
{
    ll s=0;
    for(int i=2;i<100000;i++)
    {
        if(POWE(i,3)>m)
            break;
        s+=(m/POWE(i,3));
    }
    if(s==x)
        return 2;
    if(s>x)
        return 1;
    return 0;
}

ll bs()
{
    ll f=0,l=1e18,m;
    while(1)
    {
        if(f>l)return -1;
        m=(f+l)/2;
        if(c(m)==0&&c(m+1)==2)
            return m+1;
        if(c(m)==1||c(m)==2)l=m-1;
        else f=m+1;
    }
}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>x;
    cout<<bs();

    return 0;
}

double Fib(double x,double z){
    int i=0;
    double f=x,r=x,t;
    for(i=2;i<z;i++)
    {
        t=f;
        f+=r;
        r=t;
    }
    return f;

}
string BinDec( ull x){
    string z;
    while(1)
    {
        z+=((x%3)+'0');
        x/=3;
        if(x==0)
            break;
    }
    while(1)
    {
        if(z.size()==30)
            break;
        z+='0';
    }
    reverse(z.begin(),z.end());
    return z;
}
ull BinDec(string x){
    long long i;
    unsigned long long z=1,a=0;
    for(i=x.size()-1;i>=0;i--)
    {
        if(x[i]=='1')
            a+=z;
        if(x[i]=='2')
            a+=(2*z);
        z*=3;
    }
    return a;
}
ull StringInt(string x){
   ull z=0,i;
   for(i=0;i<x.size();i++)
   {
       z*=10;
       z+=(x[i]-'0');
   }
   return z;
}
string StringInt(ll x){
    string z;
    while(x!=0)
    {
        z+=(x%10+'0');
        x/=10;
    }
    reverse(z.begin(),z.end());
    return z;
}
ull POWMOD (ull base,ull exp,ull mod){
    ull res=1;
    while(exp>0){
        if(exp%2==1)
            res=(res*base);
            res%=mod;
        exp/=2;
        base=(base*base);
        base%=mod;
    }
return res%mod;
}
ull POWE(long long base,long long exp){
    ull res=1;
    while(exp>0){
        if(exp%2==1)
            res=(res*base);
        exp/=2;
        base=(base*base);
    }
return res;

}

/*
int s=0,c[1553][1553]={},z;
char a[1550][1550]={};
void lol(char m,int i,int j,int & s)
{

    if(c[i][j+1]==0&&a[i][j+1]==m)
    {
        s++;
        c[i][j+1]=1;
        lol(m,i,j+1,s);
    }
    if(c[i][j-1]==0&&a[i][j-1]==m)
    {
        s++;
        c[i][j-1]=1;
        lol(m,i,j-1,s);
    }
    if(c[i-1][j]==0&&a[i-1][j]==m)
    {
        s++;
        c[i-1][j]=1;
        lol(m,i-1,j,s);
    }
    if(c[i+1][j]==0&&a[i+1][j]==m)
    {
        s++;
        c[i+1][j]=1;
        lol(m,i+1,j,s);
    }
    if(z!=0)
    {
        z--;
        a[i][j]='X';
    }
    return;
}*/

#include<bits\stdc++.h>
using namespace std;
#define LL long long
int main(int argc, char const *argv[]){
    LL m;
    LL ans, minans = -1;
    LL l=1, r=20000000000;
    cin>>m;
	while(l <= r) {
        LL mid = (l+r) / 2;
        ans = 0;
        for(LL k=2; k*k*k<=mid; k++) {
            ans += mid / (k*k*k);
        }

        if(ans==m) minans = mid;
        if(ans >= m) r = mid - 1;
        else l = mid + 1;
    }
	printf("%I64d\n", minans);

	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

typedef long long int NUMBERTYPE;

NUMBERTYPE howManyK(NUMBERTYPE n) {
    return pow(n,(1.0/3.0));
}

NUMBERTYPE howManyA(NUMBERTYPE n, NUMBERTYPE K){
    return ( ((double) n) / ((double) pow(K,3)) );
}

NUMBERTYPE find_N_given_A_and_K(NUMBERTYPE a, NUMBERTYPE k){
    return a*k*k*k;
}

NUMBERTYPE binarySearch(NUMBERTYPE input){

    NUMBERTYPE min = 1, max = 1000000000000000, middle;
    NUMBERTYPE temp_answer, answer = -1;

    while(min != max)
    {
        temp_answer = 0;
        middle = (min+max) >> 1;

        for(NUMBERTYPE a = 2; a <= howManyK(middle); a++)
            temp_answer += howManyA(middle,a);

        cout << min << " " << middle << " " << max << " " << temp_answer << " " << answer << " " << input << endl;

        if(answer < 0){
            if(temp_answer > input){
                max = middle - 1;
            }

            else if(temp_answer < input){
                min = middle + 1;
            }

            else {
                min = middle - 2;
                max = middle;
                answer = middle;
            }
        }

        else {
            if(temp_answer == input){
                min = middle - 2;
                max = middle;
                answer = middle;
            }
            else min = max;
        }
    }

    return answer;

}

int main() {
    NUMBERTYPE input;

    cin >> input;

    cout << binarySearch(input);

	return 0;
}

// 1493849391618

//
//  main.cpp
//  thieves
//
//  Created by Helder Mendes on 03/05/17.
//  Copyright © 2017 Helder Mendes. All rights reserved.
//

#include<cstdio>
#include<cmath>

typedef unsigned long long ull;
typedef long long ll;

int m;
int c0,c1,c2,c3;
int k;
ll ways;
ll sum;
bool doable(ll n)
{
    c1=c0*k;
    c2=c1*k;
    c3=c2*k;

    if(  (c1>n) || (c2>n) || (c3>n))
        return false;

    return true;
}

/*
bool doableWays(int n)
{

    ways=0;
    k=2;
    ///8
    for(c0=1;c0<=n/(k*k*k) && ways < m;c0++)
    {

        //pot
      //  pot =pow(n/c0,1.0/3);
        for(k=2;k*k*k<=n && ways<m ;k++)
        {
            if(doable(n))
            {
                ways++;
            }
            else
                break;
        }

    }

    if(ways==m)
    {
        return true;
    }
    return false;

}

bool doableWaysOnly(int n)
{

    ways=0;

    ///8
    for(c0=1;c0<=n/8 ;c0++)
    {

        //pot
        //  pot =pow(n/c0,1.0/3);
        for(k=2;k*k*k<=n;k++)
        {
            if(doable(n))
            {
                ways++;
            }
            else
                break;
        }

    }

    if(ways==m)
    {
        return true;
    }
    return false;

}
 */

bool doableWays(ll n)
{

    sum=0;

    ///8
    for(k=2;1LL*k*k*k<=n && sum < m ;k++)
    {
        sum+= n/(1LL*k*k*k);
    }
    if(sum>=m)
    {
        return true;
    }
    return false;

}

bool doableWaysOnly(ll n)
{

     sum=0;
    ///8
    for(k=2;1LL*k*k*k<=n ;k++)
    {
        sum+= n/(1LL*k*k*k);
    }
    if(sum==m)
    {
        return true;
    }
    return false;

}

//k>1
int main()
{

    int it;
    ll n;
    ll lo,hi;

    scanf("%d",&m);

    //estipulate k1,k2,k3,k4
    k=2;

    lo=8;
    hi=1e14;
    it=0;
    n=-1;
    while(hi!=lo && it<100)
    {
        n=(lo+hi)/2;
        if(doableWays(n))
            hi=n;
        else
            lo=n+1;
        it++;
    }

    if(it<100)
    {
            doableWaysOnly(hi);
            if(sum==m)
                printf("%lld\n",hi);
            else
                printf("%d\n",-1);
    }
    else
        printf("%d\n",-1);

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long lli;

lli root_cube(lli value){
  lli low = 1,high = 200000LL,ans = 1;
  while(low<=high){
    lli mid = (low + high)>>1LL;
    lli cube = mid*mid*mid;
    if(cube<=value){
      ans = mid;
      low = mid + 1LL;
    }else{
      high = mid - 1LL;
    }
  }
  return ans;
}

lli ways(lli value){
  lli rb = root_cube(value);
  lli ans = 0LL;
  for(lli i=2;i<=rb;i++){
    lli temp = i*i*i;
    ans+=value/temp;
  }
  return ans;
}

int main(){
  cin.sync_with_stdio(0);
  cin.tie(0);
  lli n;
  cin >> n;
  lli low =8,high = 8000000000000000,ans = high;
  while(low<=high){
    lli mid = (low + high) >> 1LL;
    lli temp = ways(mid);
    if(temp>=n){
      ans = mid;
      high = mid - 1LL;
    }else{
      low = mid + 1LL;
    }
  }

  lli temp = ways(ans);
  cout << ans << ":\n";
  if( temp == n){
    cout << ans << "\n";
  }else{
    cout << "-1\n";
  }

}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,l=0,r=1e5+1,mid,s,i;
	scanf("%lld",&n);
	while(l+1<r) {
		mid=(l+r)/2;
		s=0;
		for(i=2; i*i*i<=mid; i++)
			s+=mid/(i*i*i);
		if(s>=n)
			r=mid;
		else
			l=mid;
	}
	s=0;
	for(i=2; i*i*i<=r; i++)
		s+=r/(i*i*i);
	if(s==n)
		printf("%lld",r);
	else
		puts("-1");
}

//
//  main.cpp
//  thieves
//
//  Created by Helder Mendes on 03/05/17.
//  Copyright © 2017 Helder Mendes. All rights reserved.
//

#include<cstdio>
#include<cmath>
int m;
int c0,c1,c2,c3;
int k;
int ways;

bool doable(int n)
{
    c1=c0*k;
    c2=c1*k;
    c3=c2*k;

    if(  (c1>n) || (c2>n) || (c3>n))
        return false;

    return true;
}

bool doableWays(int n)
{

    ways=0;
    //int pot;

    ///8
    for(c0=1;c0<=n && ways < m;c0++)
    {

        //pot
      //  pot =pow(n/c0,1.0/3);
        for(k=2;k<=n && ways<m ;k++)
        {
            if(doable(n))
            {
                ways++;
            }
            else
                break;
        }

    }

    if(ways==m)
    {
        return true;
    }
    return false;

}

bool doableWaysOnly(int n)
{

    ways=0;
    c0=1;
    int pot;
    for(c0=1;c0<=n/8 ;c0++)
    {
        pot =pow(n/c0,1.0/3);
        for(k=2;k<=pot ;k++)
        {
            if(doable(n))
            {
                ways++;
            }
            else
                break;
        }

    }

    if(ways==m)
    {
        return true;
    }
    return false;

}

//k>1
int main()
{

    int it;
    int n;
    int lo,hi;

    scanf("%d",&m);

    //estipulate k1,k2,k3,k4
    k=2;

    lo=8;
    hi=1.5e9;
    it=0;
    n=-1;
    while(hi!=lo && it<100)
    {
        n=(lo+hi)/2;
        if(doableWays(n))
            hi=n;
        else
            lo=n+1;
        it++;
    }

    if(it<100)
    {
            doableWaysOnly(hi);
            if(ways==m)
                printf("%d\n",hi);
            else
                printf("%d\n",-1);
    }
    else
        printf("%d\n",-1);

    return 0;
}

#include<bits/stdc++.h>
#define MAX 100005

using namespace std;

typedef  long long int lli;

lli cubes[MAX];

lli justSmallerCube(lli val){

    lli start=2,end=MAX-1,mid;

    if(val==0) return 0;

    while(start<=end){

      lli mid=(start+end)/2;

      if(cubes[mid]==val){ return mid-1;}

      if(cubes[mid]>val)
         end=mid-1;

      if(cubes[mid]<val){

         if(cubes[mid+1]>val) return mid-1;
         else start=mid+1;
      }

    }

    return 0;

}

lli isOk(lli m,lli maxValue){

    for(lli i=2;i<=MAX;i++){
       lli now=(maxValue/(cubes[i]) );
      // cout<<"\nFor "<<i<<" it returned "<<now;
       if(now==0) break;
       m-=now;

     }

    return m;

}

int main(void){

   lli i,j,n;

   //cout<<justSmallerCube(27);

   cin>>n;

   lli start=0,end=1000000000000000LL;
   for(i=0;i<MAX;i++)
      cubes[i]=i*i*i;

   while(start<=end){

     lli mid=(start+end)/2;

     //cout<<"\nChecking for "<<mid;

     if(isOk(n,mid)==0){//check

       if(mid==1){
          cout<<mid;
          return 0;
       }

       if(isOk(n,mid-1)!=0){
       cout<<mid;
       return 0;
       }

       end=mid-1;

     }

     else if(isOk(n,mid)<0) end=mid-1;
     else start=mid+1;

   }

   cout<<"-1";

   return 0;

}

#include<cstdio>

__int64 cifang(__int64 x)
{
    return x*x*x;
}
int pan(__int64 x,__int64 m)
{
    __int64 i,sum=0;
    for(i=2;i<=1e6;++i)
        sum+=x/cifang(i);
    //printf("1\n");
    if(sum<m) return -1;
    else if(sum>m) return 1;
    return 0;
}
int main()
{
    __int64 n,m,l=1,r=1e15;
    scanf("%I64d",&m);
    //printf("%d\n",m);
    int a=1;
    while(l<r)
    {
        __int64 mid=(l+r)/2;
        //printf("%I64d %I64d\n",l,r);
        switch(pan(mid,m))
        {
            case 1:r=mid-1;
        //printf("%d\n",a++);
        break;
            case -1:l=mid+1;
        //printf("%d\n",a++);
        break;
            default:l=r=mid;
        //printf("%d\n",a++);
        break;
        }
    }
    if((l==r) && (pan(l,m)==0))
    {while(!pan(l,m)) --l;
    printf("%I64d\n",l+1);}
    else printf("-1\n");
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

long long m;

long long F(long long n) {
	long long res = 0;
	for (long long k = 2; k <= 100000; ++k) {
		long long val = n / (k * k * k);
		long long root = val;
		res += root;
	}
	return res;
}

int main() {
	scanf("%lld", &m);
	long long l = 2, r = 1e18, ans = -1;
	for (int i = 0; i < 100; ++i) {
		long long n = (l + r) >> 1;
		long long temp = F(n);
		if (temp == m) {
			ans = n;
			r = n;
		} else if (temp > m) {
			r = n;
		} else {
			l = n;
		}
	}
	printf("%lld", ans);
	return 0;
}

#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
	return x;
    else
	return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
	if(m%2)
	    r=(r*n)%p;
	n=(n*n)%p;
	m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
	if (n%i == 0 || n%(i+2) == 0)
	   return false;

    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
	if (i <= r)
	    z[i] = min (r - i + 1, z[i - l]);
	while (i + z[i] < n && s[z[i]] == s[i + z[i]])
	    ++z[i];
	if (i + z[i] - 1 > r)
	    l = i, r = i + z[i] - 1;
    }
    return z;
}
int32_t main()
{
   IOS;
   #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/
   int m;
   cin>>m;
   int l=1,h=1e15;
   while(l<h)
   {
   	int mid=(l+h)/2;
   	int s=0;
   	for(int i=2;i<=100000;i++)
   	{
   		int c=i*i*i;
   		s=s+floor(mid/c);
   	}
   	if(s>m)
   	{
   		h=mid-1;
   	}
   	else if(s==m)
   	{
   		h=mid;
   	}
   	else
   	{
   		l=mid+1;
   	}
   }
   int s=0;
   for(int i=2;i<=100000;i++)
   {
   	int c=i*i*i;
   	s=s+floor(l/c);
   }
   if(s!=m)
   {
   	cout<<-1<<endl;
   	return 0;
   }
   cout<<l<<endl;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

#ifndef ONLINE_JUDGE
auto __redirect__ = freopen("in", "r", stdin);
#endif

#define ln '\n'
#define lsb(x) (x&-x)
#define del(x) if(x) delete x

#define rep(i,a,b) for(int i = a; i < b; ++i)
#define repq(i,a,b) for(int i = a; i <= b; ++i)

#define rev(i,a,b) for(int i = a; i >= b; --i)
#define revn(i,a,b) for(int i = a; i > b; --i)

#define repc(i,a,cond) for(int i = a; cond; ++i)
#define revc(i,a,cond) for(int i = a; cond; --i)

int const N = 2e5 + 16;
int const M = 1e9 + 7;

int m;

ll count(ll n) {
  ll cnt = 0;

  for(ll i = 2; i <= 1e6; ++i) {
    cnt += n/(i*i*i);

    if(cnt > m)
      return m+1;
  }

  return cnt;
}

int main() {
  scanf("%d", &m);

  ll l = 8;
  ll r = 8e18;

  ll res = 8e18;

  bool ans = false;

  while(l <= r) {
    ll n = (l+r) >> 1;
    ll c = count(n);

    if(c == m) {
      ans = true;
      res = min(res, n);
      r = n - 1;
    } else if(c < m) {
      l = n + 1;
    } else {
      r = n - 1;
    }

  }

  printf("%lld\n", ans?res:-1LL);
}

#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long int NUMBERTYPE;

NUMBERTYPE howManyK(NUMBERTYPE n) {
    //if(n == 64) cout << pow(n,(1.0/3.0)) << endl;
    return pow(n,(1.0/3.0));
}

NUMBERTYPE howManyA(NUMBERTYPE n, NUMBERTYPE K){
    //if(n == 64) cout << K << " " << ( ((double) n) / ((double) pow(K,3)) ) << endl;
    return ( ((double) n) / ((double) pow(K,3)) );
}

NUMBERTYPE find_N_given_A_and_K(NUMBERTYPE a, NUMBERTYPE k){
    return a*k*k*k;
}

NUMBERTYPE binarySearch(NUMBERTYPE input){

    NUMBERTYPE min = 1, max = 1000000000000000, middle;
    NUMBERTYPE temp_answer, answer = -1;

    while(min < max)
    {
        temp_answer = 0;
        middle = (min+max) >> 1;

        for(NUMBERTYPE a = 2; a <= (howManyK(middle) + 1); a++)
            temp_answer += howManyA(middle,a);

        //cout << min << " " << middle << " " << max << " " << temp_answer << " " << answer << " " << input << endl;

        if(answer < 0){
            if(temp_answer > input){
                max = middle - 1;
            }

            else if(temp_answer < input){
                min = middle + 1;
            }

            else {
                min = middle - 2;
                max = middle;
                answer = middle;
            }
        }

        else {
            if(temp_answer == input){
                min = middle - 2;
                max = middle;
                answer = middle;
            }
            else min = max;
        }
    }

    return answer;

}

int main() {
    NUMBERTYPE input;

    scanf("%lld", &input);

    cout << binarySearch(input);

	return 0;
}
// 1493884982037

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <utility>
#include <ctime>
#include <map>
#include <set>

using namespace std;

#define X first
#define Y second
#define Z third
#define mp make_pair
#define mt make_triple

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.141592653589793;
const ld E = 2.71828182845904523;
const ll LLINF = 9000000009000000099;
const ll INF = 2009000099;
const ll MOD7 = 1000000007;
const ll MOD9 = 1000000009;

template<class A, class B, class C> struct triple { A first; B second; C third; triple(A, B, C); triple(); };
template<class A, class B, class C> triple<A, B, C>::triple(A a, B b, C c) { first = a; second = b; third = c; }
template<class A, class B, class C> triple<A, B, C>::triple() { }
template<class A, class B, class C> triple<A, B, C> make_triple(A a, B b, C c){ triple<A, B, C> t(a, b, c); return t; }
template<class A, class B, class C> bool operator<(triple<A, B, C> a, triple<A, B, C> b){ if (a.first != b.first) return a.first < b.first; if (a.second != b.second) return a.second < b.second; if (a.third != b.third) return a.third < b.third; }
template<class T> T inline sqr(T a) { return a * a; }

ll pow(ll a, ll d, ll mod = LLINF) { if (d == 1) return a; ll t = pow(a, d / 2, mod); t = (t * t) % mod; if (d & 1) t = (t * a) % mod; return t; }
ll gcd(ll a, ll b) { while (a && b) if (a > b) a %= b; else b %= a; return a + b; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll m;
int check(ll& mid, vector<ll>& c)
{
  ll nm = mid;
  ll k = 0;
  for (int i = 0; i < c.size(); ++i)
    k += mid / c[i];// nm = min(nm, mid - mid % c[i]);

  return k >= m;
}

int checkr(ll& mid, vector<ll>& c)
{
  ll nm = mid;
  ll k = 0;
  for (int i = 0; i < c.size(); ++i)
    k += mid / c[i];// nm = min(nm, mid - mid % c[i]);

  return k == m;
}

int main(){
  ios::sync_with_stdio(0);
  vector<ll> c;
  for (ll i = 2; i <= 1e5 + 100; ++i)
    c.push_back(i * i * i);

  cin >> m;

  ll L = 0, r = 8e16;

  while (r - L > 1)
  {
    ll mid = (r + L) / 2;
    if (check(mid, c)) r = mid;
    else L = mid;
  }

  if (checkr(r, c))
    cout << r;
  else
    cout << -1;

}

#include <iostream>
#include <climits>

using namespace std;

unsigned long long test(unsigned long long m) {
	unsigned long long c = 0;
	for(unsigned long long i = 2 ; (i*i*i) <= m ; ++i){
		unsigned long long _pot = i*i*i;
		unsigned long long l = 1, r = (m/_pot)+1;
		bool found = false;
		unsigned long long mid, a0_pot;
		while(r-l > 1 && !found){
			mid = (l+((r-l)>>1));
			a0_pot = mid*_pot;
			if(a0_pot == m){
				found = true;
				break;
			}
			else if(a0_pot < m)
				l = mid;
			else
				r = mid;
		}
		if(found){
			c += mid;
		}
		else{
			if(r*_pot <= m)
				c += r;
			else if(l*_pot <= m)
				c += l;
		}
	}
	return c;
}

int main() {
	unsigned long long n;
	cin >> n;
	unsigned long long l = 0, r = ULONG_MAX;
	while(r-l > 1) {
		unsigned long long m = (l+((r-l)>>1));
		unsigned long long _try = test(m);
		if(_try < n){
			l = m;
		}
		else
			r = m;
	}
	if(test(l) == n)
		cout << l << endl;
	else if(test(r) == n)
		cout << r << endl;
	else
		cout << -1 << endl;
	return 0;
}

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue

// template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double eps = 1e-9;
ll pow3(ll n){
    for(ll i = 1; i <= n; ++i){
        if(i * i * i > n)
            return i - 1;
    }
    return -1;
}
ll f(ll a, ll m){
    ll l = 1, r = m;
    ll mx = 1;
    while(l <= r){
        ll md = (l + r) / 2;
        if((a * a * a <= LONG_MAX / md)&& ( a * a * a * md <= m)){
            l = md + 1;
            mx = max(mx, md);
        }
        else {
            r = md - 1;
        }
    }
    return mx;
}
void solve(){
    ll m;
    cin >> m;
    // k ^ 3
    ll l = 1, r = 1e15 + 113123123123;
    ll kol = 0;
    ll ans = 0;
    while(l <= r){
        ll md = (l + r) / 2;
        ll o = 0;
        for(ll i = 2; i * i * i <= md; ++i){
            o += f(i, md);
        }
        if(o < m ){
            // kol = o;
            l = md + 1;
        }
        else if(o == m){
            kol = m;
            ans = md;
            r = md - 1;
        }
        else{
            r = md - 1;
        }
    }
    cout << ((kol == m) ? ans : -1);

}

int main(){
    // speed();
    int t = 1;

    while(t--)solve();
}

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using ti3 = tuple<int, int, int>;
using vti3 = vector<ti3>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
ll f(int n) {
	ll ans = 0;
	for (ll i = 1; n >= 8 * i; i++) {
		for (ll k = 2; k*k*k*i <= n; k++)ans++;
	}
	return ans;
}
int main() {
	ll m,ans=0;
	cin >> m;
	ll r = 0, l = 1<<60;
	for (;;) {
		ll t = (r + l) / 2;
		int ans = f(t);
		if (ans == m) {
			if (r != t) {
				l = t;
				continue;
			}
			r = l = t;
			cout << r << endl;
			return 0;
		}
		else if (ans > m)l = t - 1;
		else r = t + 1;
		if (l < r) {
			cout << -1 << endl;
			return 0;
		}
	}
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int middle=-1,m,start=1,end=10000000000000000;
	cin>>m;
	long long int flag=0,ans=0;

	while(start<end)
	{
		middle=(start+end)/2;
		//int cube=cbrt(middle);
		ans=0;
//		cout<<middle<<" ";
		for(long long int i=2;i*i*i<=middle;i++)
		{
			ans+=middle/(1LL*i*i*i);
		}
		if(ans<m)
		{
			start=middle+1;
		}
		else if(ans>m)
		{
			end=middle-1;
		}
		else if(ans==m)
		{
			break;
		}
	}
		cout<<middle<<endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, K)
#define ffa ffi ffj
#define s <<" "<<
#define w cout
#define e endl
#define pb push_back
#define mp make_pair
#define a first
#define b second
//500,000,000 operations
//Global Variables
int M, mid, ways;

void calc() {
    ways = 0;
    For (i, 2, 100001) {
        ll big = i*i*i;
        if (mid >= big) {
            ways += (int)(mid/big);
            //w<< mid/big<<e;
        }
        else break;
    }
}

int main() {
    //ifstream cin ("test.in");
    cin >> M;

    int a = 1;
    int b = 100000;
    while (a < b) {
        mid = (a+b)/2;
        calc();
        //w<< a s b s mid<<e;
        if (ways > M) b = mid;
        else if (ways < M) a = mid+1;
        else b = mid;

    }
    if (ways != M) a = -1;
    w<< a <<e;
	return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;

long long getMax(long long a, long long b) {
    return a * pow(b, 3);
}

long long getCount(long long n) {
    long long count = 0;
    for (int b = 2; b < n; b++) {
        long long a = n / pow(b, 3);
        if (a == 0) {
            break;
        }
        count += a;
    }
    return count;
}

int main(int argc, char const *argv[])
{
    long long m;
    cin >> m;

    long long n = 8;
    while (true) {
        auto count = getCount(n);
        if (count >= m) {
            break;
        }
        n *= 2;
    }

    long long max_n = n, min_n = n / 2;
    while (min_n <= max_n) {
        n = (max_n + min_n) / 2;
        long long count = getCount(n);
        if (count > m) {
            max_n = n - 1;
        }
        else if (count < m) {
            min_n = n + 1;
        }
        else {
            break;
        }
    }

    long long count = getCount(n);
    if (count != m) {
        cout << -1 << endl;
        return 0;
    }

    while (min_n < max_n - 1) {
        n = (max_n + min_n) / 2;
        long long new_count = getCount(n);
        if (new_count < count) {
            min_n = n + 1;
        }
        else {
            max_n = n;
        }
    }

    cout << (getCount(n - 1) == count ? n - 1 : n) << endl;

    return 0;
}

/* ন কাঙ্ক্ষে বিজয়ং কৃষ্ণ ন চ রাজ্যং সুখানি চ */
#include<bits/stdc++.h>
using namespace std;
#define sc(x) scanf("%d", &x)
#define scc(x, y) scanf("%d %d", &x, &y)
#define lng long long

int check(lng x){
    lng ret = 0;
    for(lng i=2; i*i*i <= x; i++){
        ret += x/(i*i*i);
    }
    //cout<<x<<" "<<ret<<endl;
    return ret;
}

int bs(lng m){
    int lo=0, hi=100005;
    while(lo < hi) {
        int mid = (lo+hi)/2;
        if(check(mid) < m) lo = mid+1;
        else hi = mid;
    }
    return check(lo)==m ? lo : -1;
}

int main(){
    lng m;
    cin>>m;
    cout<<bs(m)<<endl;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

ll calc(ll num)
{
    ll ans=0;

    for(ll i=2;i*i*i<=num;i++)
    {
        ans+=(num/(i*i*i));
    }

    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll test=1;
    //cin>>test;
    while(test--)
    {
        ll m;
        cin>>m;

        ll l=1,r=1e15;

        ll n=-1;

        ll mid;

        while(l<r)
        {
            mid=(l+r)/2;

            if(calc(mid)<m)
            l=mid+1;
            else
            r=mid;
        }

        if(calc(l)==m)
        n=l;

        cout<<n;
    }
}

#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
#define INF 1000000000000000000
#define endll "\n"
#define pb push_back
#define forn(i,n) for(i=0;i<n;i++)
#define forab(i,a,b) for(i=a;i<=b;i++)
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define vll vector<ll>
#define ff first
#define ss second
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define test ll t;cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define N 500005
void inout()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
bool check(ll m, ll n)
{
	ll ans = 0;
	for (ll i = 2; i * i * i <= m; i++)
		ans += (m / (1LL * i * i * i));
	return ans >= n;
}
int main()
{
	fast_io;
	inout();
	ll n, l, r, ans = -1;
	cin >> n;
	l = 0;
	r = 100;
	while (l <= r)
	{
		ll mid = (l + r) / 2;
		if (check(mid, n))
		{
			ans = mid;
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	ll x = 0;
	for (ll i = 2; i * i * i <= ans; i++)
		x += (ans / (i * i * i));
	if (x == n)
		cout << ans << endl;
	else
		cout << -1 << endl;
	return 0;
}

//#pragma comment (linker, "/STACK:128000000")
//#define _CRT_SECURE_NO_DEPRECATE
//#define _SECURE_SCL 0
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define MOD 1000000007
#define MAXN 10

using namespace std;

long long getCnt(long long mid) {
    long long k = 2;
    long long cnt = 0;

    while ((1LL * k * k * k) <= mid) {
        long long x = mid / (1LL * k * k * k);

        cnt += x;
        k++;
    }

    return cnt;
}

int main(){
//    freopen( "input.txt", "r", stdin );
//    freopen( "output.txt", "w", stdout );

    long long m;
    cin >> m;

    long long l = 1, r = 1000000000000000LL;
    long long res = -1;

    while (l < r) {
        long long mid = l + (r - l) / 2;

        long long cnt = getCnt(mid);

        if (cnt > m) {
            r = mid - 1;
        }
        else if (cnt < m) {
            l = mid + 1;
        }
        else {
            while (getCnt(mid) == cnt) {
                mid--;
            }
            res = mid + 1;
            break;
        }
    }

    cout << res << endl;

    return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);

	long long m;
	cin>>m;

	long long start,end;
	start = 1;
	end=1000000000000000;

	long long  ans = -1;

	while(start<=end){
		long long n = (start+end)/2;

		long long temp = 0;

		for(long long i=2;i<= cbrt(n);i++){
			temp += n/(i*i*i);
		}

		if(temp == m){ans = n;}
		if(temp < m){start = n+1;}else{end = n-1;}
	}

	cout<<ans;

	return 0;
}

#include <iostream>
using namespace std;
/*
    Hotii fura asa:
    x, x*k, x*k*k, x*k*k*k
    Avem tuplurile astea:
    1   (1, 2, 4, 8)
    2   (2, 4, 8, 16)
    3   (3, 6, 12, 24)
    4   (1, 3, 9, 27)
    5   (1, 4, 16, 32)
    6   (5, 10, 20, 40)
    7   (6, 12, 24, 48)
    8   (2, 6, 18, 54)
    9   (7, 14, 28, 56)
    11  (1, 4, 16, 64), (8, 16, 32, 64)
    12  (9, 18, 36, 72)
    Ce se observa: 64 = 2^6 => 2^6, 2^5, 2^4, 2^3
                            => 2^6, 2^4, 2^2, 2^0
    Ne intereseaza numerele ce au in descompunerea in factori primi puteri mari astfel incat sa accepte scrierea
    in mai multe feluri
    2^9 => 2^9, 2^8, 2^7, 2^6
        => 2^9, 2^7, 2^5, 2^3
        => 2^9, 2^6, 2^3, 2^0
    Adica radical de ordin trei dintr-unul dintre factorii primi sa existe imi genereaza atatea combinatii cat este el
    Daca la intrare am n = 6 atunci se poate deoarece sunt primele 6 din enumerare
    Daca la intrare am n = 9 atunci se poate deoarece sunt primele 9 din enumerare
    Daca la intrare am n = 10 atunci NU se poate deoarece 64 genereaza doua combinatii
    Care este numarul de combinatii generate?
    radical de ordin 3 din 64 (2^6) este 4, si obtin doua combinatii
    radical de ordin 3 din 512 (2^9) este 8 si obtin trei combinatii
    Numarul de combinatii este numarul de k-uri diferiti pe care ii pot obtine
    2 <= k <= radical de ordin 3 din ( n / x )
    k fixat. Ma intereseaza cati de x am astfel incat
    x < x*k < x * k * k < x * k * k * k.
    Am nr NR. Parcurg totate val k posibile, intre 2 si o valoare val, a.i. val*val*val <= NR
    Pentru fiecare valoare vad cati de x indeplinesc x < x*k < x * k * k < x * k * k * k, adica NR / (k*k*k)
    Ar putea fi facut si cu o preprocesare: precalculez valorile intr-un vct...
*/

int main()
{
    ios_base::sync_with_stdio(false);
    ///int i; asta mi-a dat niste raspunsuri gresite si mi-a luat jum de ora sa imi dau seama...
    long long m, st = 1, dr = 1e15, rasp = -1, mij, nr_sol, i;
    cin >> m;
    while( st <= dr )
    {
        mij = (st + dr) / 2;
        nr_sol = 0;
        for( i = 2; i*i*i <= mij; ++i )
            nr_sol = nr_sol + ( mij / (i*i*i) );
        if( nr_sol == m )
            rasp = mij;
        //cout << nr_sol << endl;
        //cin.get();
        if( nr_sol >= m) /// Dc nu pun ">=" da raspuns prost pt ca se cere CEL MAI MIC posibil
            dr = mij - 1;
        else
            st = mij + 1;
    }
    cout << rasp;

    return 0;
}

#include<bits\stdc++.h>
using namespace std;
#define LL long long
int main(int argc, char const *argv[]){
    LL m;
    LL ans, minans = -1;
    LL l=1, r=20000000000;
    cin>>m;
	while(l <= r) {
        LL mid = (l+r) / 2;
        ans = 0;
        for(LL k=2; k*k*k<=mid; k++) {
            ans += mid / (k*k*k);
        }

        if(ans==m) minans = mid;
        if(ans >= m) r = mid - 1;
        else l = mid + 1;
    }
	printf("%I64d\n", minans);

	return 0;
}

#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <set>
#include <map>
#include <cmath>

#define forn(i,n) for(int i = 0; i < n; i++)
#define ford(i,n) for(long long i = n - 1; i > -1; i--)
#define forl(i,l,r) for(long long i = l; i <= r; i++)
#define forst(it, a, ll) for(set < ll > :: iterator it = a.begin(); it != a.end(); it++)
#define forld(i,l,r) for(long long i = l; i >= r; i--)
#define FAST_READ ios_base::sync_with_stdio(false);
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define MAXN 200010
#define INF 1000000000
#define MOD 1000000007LL
#define pi 3.14159265358973238462643383
#define EPS 0.00000001
#define f first
#define s second
#define pb push_back
#define mp(i, j) make_pair(i, j)
#define COUT(n, a) fixed << setprecision(a) << n

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
typedef long double ld;
typedef string str;
typedef pair < ll, ll > pr;

using namespace std;

ll n;

ll check(ll mm)
{
    ll i = 1, l = 0, r, m, ans = 0;

    while(1)
    {
        l = 0;
        r = sqrt(mm) + mm;

        while(r - l > 1)
        {
            ll m = (l + r) / 2;

            if (i * m * m * m > mm)
                r = m;
            else
                l = m;
        }

        if (r < 2 || ans >= n)
            return ans;

        if (r * r * r * i <= mm)
            l = r;

        ans += l - 1;
        i++;
    }
}

ll check2(ll mm)
{
    ll i = 1, l = 0, r, m, ans = 0;

    while(1)
    {
        l = 0;
        r = sqrt(mm) + mm;

        while(r - l > 1)
        {
            ll m = (l + r) / 2;

            if (i * m * m * m > mm)
                r = m;
            else
                l = m;
        }

        if (r < 2 || ans > n)
            return ans;

        if (r * r * r * i <= mm)
            l = r;

        ans += l - 1;
        i++;
    }
}

int main()
{
    FAST_READ

    ll l = -1, r = INF / 10, m;

    cin >> n;

    while(r - l > 1)
    {
        m = (l + r) / 2;

        if (check(m) >= n)
            r = m;
        else
            l = m;
    }

    if (check2(l) != n && check2(r) != n)
        cout << -1 << endl;
    else
        if (check2(l) == n)
        cout << l << endl;
    else
        cout << r << endl;
}

#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;
ll n;

bool ch(ll  m){
    ll t = 0;
    for(ll i=2 ; i<=2*1e5; i++){
        ll r= i*i*i;
        t += (1.0*m/r + 0.00000001);
        if(t >= n)return 1;
    }

    return t >= n;
}
bool ch2(ll  m){
    ll t = 0;
    for(ll i=2 ; i<=2*1e5 ; i++){
        ll r= i*i*i;
        t += (1.0*m/r + 0.00000001) ;
    }

    return t == n;
}

ll bin(){
    ll res = -1;
    ll l = 0,h = 1e18;
    while(l <= h){
        ll m = (l+h)/2;
        if(ch(m)){
            res = m;
            h = m-1;
        }
        else{
            l = m+1;
        }
    }
    return res;
}

int main(){
    ios::sync_with_stdio(0);
    cin>>n;
    ll res = bin();
    if(res != -1 && ch2(res)){
        cout<<res;
    }
    else{
        cout<<-1;
    }
    return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);

	long long m;
	cin>>m;

	long long start,end;
	start = 1;
	end=100000;

	long long  ans = -1;

	while(start<=end){
		long long n = (start+end)/2;

		long long temp = 0;

		for(long long i=2;i<= cbrt(n);i++){
			temp += n/(i*i*i);
		}

		if(temp == m){ans = (cbrt(n));ans=ans*ans*ans*(n/(ans*ans*ans));break;}
		if(temp < m){start = n+1;}else{end = n-1;}
	}

	cout<<ans;

	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

typedef long long int NUMBERTYPE;

NUMBERTYPE howManyK(NUMBERTYPE n) {
    //if(n == 64) cout << pow(n,(1.0/3.0)) << endl;
    return pow(n,(1.0/3.0));
}

NUMBERTYPE howManyA(NUMBERTYPE n, NUMBERTYPE K){
    //if(n == 64) cout << K << " " << ( ((double) n) / ((double) pow(K,3)) ) << endl;
    return ( ((double) n) / ((double) pow(K,3)) );
}

NUMBERTYPE find_N_given_A_and_K(NUMBERTYPE a, NUMBERTYPE k){
    return a*k*k*k;
}

NUMBERTYPE binarySearch(NUMBERTYPE input){

    NUMBERTYPE min = 1, max = 1000000000000000, middle;
    NUMBERTYPE temp_answer, answer = -1;

    while(min < max)
    {
        temp_answer = 0;
        middle = (min+max) >> 1;

        for(NUMBERTYPE a = 2; a <= (howManyK(middle) + 1); a++)
            temp_answer += howManyA(middle,a);

        //cout << min << " " << middle << " " << max << " " << temp_answer << " " << answer << " " << input << endl;

        if(answer < 0){
            if(temp_answer > input){
                max = middle - 1;
            }

            else if(temp_answer < input){
                min = middle + 1;
            }

            else {
                min = middle - 2;
                max = middle;
                answer = middle;
            }
        }

        else {
            if(temp_answer == input){
                min = middle - 2;
                max = middle;
                answer = middle;
            }
            else min = max;
        }
    }

    return answer;

}

int main() {
    NUMBERTYPE input;

    cin >> input;

    cout << binarySearch(input);

	return 0;
}

// 1493857449892

#include<bits/stdc++.h>
#define MAX 100001

using namespace std;

typedef  long long int lli;

lli cubes[MAX];

lli justSmallerCube(lli val){

    lli start=2,end=MAX-1,mid;

    if(val==0) return 0;

    while(start<=end){

      lli mid=(start+end)/2;

      if(cubes[mid]==val){ return mid-1;}

      if(cubes[mid]>val)
         end=mid-1;

      if(cubes[mid]<val){

         if(cubes[mid+1]>val) return mid-1;
         else start=mid+1;
      }

    }

    return 0;

}

lli isOk(lli m,lli maxValue){

    for(lli i=1;i<=MAX;i++){
       lli now=justSmallerCube(maxValue/i);
      // cout<<"\nFor "<<i<<" it returned "<<now;
       if(now==0) break;
       m-=now;
     }

    // cout<<"\nWhen checking for "<<maxValue<<" we have m as "<<m;

    return m;

}

int main(void){

   lli i,j,n;

   //cout<<justSmallerCube(27);

   cin>>n;

   lli start=1,end=1000000000000000000LL;
   for(i=0;i<MAX;i++)
      cubes[i]=i*i*i;

   while(start<=end){

     lli mid=(start+end)/2;

     //cout<<"\nChecking for "<<mid;

     if(isOk(n,mid)==0){//check

       if(mid==1){
          cout<<mid;
          return 0;
       }

       if(isOk(n,mid-1)!=0){
       cout<<mid;
       return 0;
       }

       end=mid-1;

     }

     else if(isOk(n,mid)<0) end=mid-1;
     else start=mid+1;

   }

   cout<<"-1";

   return 0;

}

//my magic will tear you apart!
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cstdlib>
using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
typedef long long ll;
const ll D = 100100;
ll m;

ll cnt(ll x) {
  ll ret = 0;
  for(int k = 2; k <= D; k++) {
    ret += x/k/k/k;
  }
  return ret;
}

ll bsearch(ll lo, ll hi) {
  if(lo >= hi) {return lo;}
  ll mid = (lo + hi)/2;
  if(cnt(mid) < m) {
    return bsearch(mid + 1, hi);
  } else {
    return bsearch(lo, mid);
  }
}
int main() {
  if(fopen("C.in","r")) freopen("C.in","r",stdin);
  cin >> m;
  ll ans = bsearch(1L, 1000000000000000000L);
  if(cnt(ans) != m) {
    cout << "-1";
    return 0;
  }
  cout << ans;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s)
{
  return '"' + s + '"';
}

string to_string(const char *s)
{
  return to_string((string)s);
}

string to_string(bool b)
{
  return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
  string res = "";
  for (size_t i = 0; i < N; i++)
  {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v)
{
  bool first = true;
  string res = "{";
  for (const auto &x : v)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  long long m;
  cin >> m;
  auto check = [&](long long n) {
    long long no_a = 0LL;
    for (long long i = 2LL; i * i * i <= n; ++i)
    {
      no_a += n / (1ll* i * i * i);
    }
    return no_a;
  };
  long long hi = 1e15L, lo = 0, mid, ans = 1e15L;
  while (lo <= hi)
  {
    mid = (hi + lo) / 2;
    debug(mid);
    if (check(mid) < m)
    {
      lo = mid + 1;
    }
    else
    {
      ans = min (ans, mid);
      hi = mid - 1;
    }
  }
  if (check(ans) != m)
    ans = -1;
  cout << ans;
}

#include <bits/stdc++.h>
#define int long long
using namespace std;
int check(int md , int m){
    int ans = 0 ;
    for(int i=2;i*i*i<=md;i++){
        ans += md/(i*i*i) ;
    }
    if(ans==m) return 2 ;
    return (ans>=m) ;
}
signed main(){
    int m ;
    cin>>m ;
    int l = 0 , r= 1e15+1  ;
    while(r-l-1){
        int md = (r+l)/2 ;
        if(check(md,m)) r=md ;
        else l  = md ;
    }
    cout << (check(r,m)==2?r:-1) ;
    return 0 ;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll get(ll n)
{
	ll ans = 0;
	for(ll i = 2; (i*i*i) <= n; i++)
	{
		ans += n/(1ll*i*i*i);
	}
	return ans;
}
int main()
{
	ll m;
	cin >> m;
	ll low = 0, high = 2e18,temp = 50;
	while(temp--)
	{
	    ll mid = (low+high)/2;
		if(get(mid) <= m)
		low = mid;
		else if(get(mid) > m)
		high = mid;
	}
	if(get(low) == m)
	cout << low << '\n';
	else
	cout << "-1" << '\n';
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(ll i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((mask)&(1LL<<pos))
#define     rset(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     sett(mask,pos)          ((mask)|(1LL<<pos))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger { template<typename T> debugger& operator , (const T v) { cerr<<v<<" "; return *this; } } dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

ll m;

ll cal(ll n)
{
    ll ans = 0;
    For(i,2,1e5)
    {
        if(n/i==0)break;
        ans+=(n/(i*i*i));
    }
    return ans;
}

int main()
{
    fastIO;
    cin>>m;
    ll b = 0,e = 10e15+7,ans=inf;
    while(b<e)
    {
        ll mid = (b+e)/2;
//        deb(b,mid,e);
        if(cal(mid)==m)
        {
            ans = mid;
            e = mid-1;
        }
        else if(cal(mid)>m)
        {
            e = mid-1;
        }
        else
        {
            b = mid+1;
        }
    }
    cout<<(ans<inf?ans:-1)<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define LL long long
LL n;
LL solve(LL x){
    LL ans=0;
    for(LL i=2;i<=100000&&i*i*i<=x;i++){
        ans+=x/(i*i*i);
    }
    return ans;
}
LL ddd(){
    LL l=1,r=1LL<<61;
	while(l<r){
        LL mid=(l+r)>>1;
        if(solve(mid)>=n) r=mid;
        else l=mid;
        if(l==r-1){
            if(solve(l)==n)
                return l;
            else if(solve(r)==n)
                return r;
            return -1;
        }
	}
}
int main() {
	cin>>n;
	cout<<ddd()<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

typedef __int64 ll;
const ll maxn = 5e7+5;
int a[maxn];

void ini() {
	memset(a, 0, sizeof(a));
	for(ll j = 1; j <= 50; j++) {
		for(ll i = 2; i <= 100; i++) {
			a[j*i*i*i]++;
		}
	}
}

int main() {
	ll m;
	scanf("%I64d", &m);
	ini();
	ll sum = 0;
	for(int i = 8;; i++) {
		sum += a[i];
		if(sum == m) {
			printf("%d", i);
			break;
		}
		else if(sum > m) {
			printf("-1");
			break;
		}
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int solve(ll n,ll m){
	ll sol=0;
	for (ll i=2;i*i*i<=n;i++){
		sol+=n/(i*i*i);
	}
	if (sol==m){
		return 0;
	}else if (sol>m){
		return 1;
	}else{
		return -1;
	}
}

int main(int argc, char const *argv[])
{
	ll m;
	cin>>m;
	ll l=0;
	ll r=1000000;
	ll ans=r+1;
	while (l<r){
		ll mid=l+(r-l)/2;
		int tans=solve(mid,m);
		if (tans==0){
			if (mid<ans)
				ans=mid;
			//find smaller
			r=mid-1;
		}else if (tans==1)
		{
			r=mid-1;
		}else
			l=mid+1;
	}
	if (ans==1000001)
		cout<<"-1";
	else
		cout<<ans;
	return 0;
}

#include <bits/stdc++.h>
#define oo 1000000000000000ll
using namespace std;
typedef long long ll;
ll m;
ll cal(ll n)
{
    ll kq=0;
    for(ll i=1;i*i*i<=n;i++)
    kq+=i*(n/(i*i*i)-n/((i+1)*(i+1)*(i+1)));
    return kq-n;
}
ll res()
{
    ll d=1,c=oo,g,t,kq=-1;
    while(d<=c)
    {
        g=(d+c)/2;
        t=cal(g);
        if(t==m)
        {
            kq=g;
            c=g-1;
        }
        else
        if(t>m) c=g-1;
        else d=g+1;
    }
    return kq;
}
int main()
{
    cin>>m;
    cout<<res();
}

#include<bits/stdc++.h>
#define int long long int
using namespace std;
main(){
    int m;cin>>m;
    int l=0,r=1e18;
    while(r-l>1){
     int md=(r+l)/2;
     int mm=0;
     for(int i=0;i<200000;i++){
          int k=(i+2)*(i+2)*(i+2);
          mm+=md/k;
     }
     if(mm>=m)r=md;
     else l=md;
    }
    cout<<r;
}

#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
using namespace std;
ll mod = 1e9+7;
int m;
ll ways(ll n){
    ll ans = 0ll;
    for (ll i = 2; i*i*i <= n; ++i){
        ans += n/(i*i*i);
    }
    return ans;
}
void solve(){
      cin >> m;
      ll left = 1ll, right = 1e18, mid;
      while (left < right){
          mid = (left+right)/2;
          if (ways(mid) < m){
              left = mid+1;
          }else{
              right = mid;
          }
      }
      if (ways(left) != m){
          left = -1;
      }
      cout << left << '\n';
}
int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int tests;
    solve();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll m, n, r, l, ans, mid,cnt;

ll judge(ll k)
{
	ans = 0;
	for(ll i = 2; i * i * i <= k; i++)
	{
		ans += k / (i * i * i);
	}
	return ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> m;
	l = 1; r = 1e18;
	cnt = -1;
	while(l < r)
	{
		mid = (l + r) / 2;
		ans = judge(mid);
		if(ans > m)	r = mid - 1;
		if(ans < m)	l = mid + 1;
		if(ans == m)
		{
			cnt = mid;
			r = mid;
		}
	}
	cout << cnt;
	return 0;
}

#include <iostream>
#include <cstdio>

using namespace std;

// Verifica o numero passado por parametro
long long int verifyMiddle(long long int middle){
	long long int k;
	long long int sum = 0, calc;

	k = 2;
	while(k){
		calc = k * k * k;
		if(calc > middle ) return sum;
		sum += (middle / calc);
		k++;
	}

	return sum;
}

// Encontra o valor do 'n'
long long int computeN(long long int m){
	long long int begin = 1, end = 1000000000000000, middle, sum = 0;

	while(end > begin+1){
		middle = (begin + end)/2;

		sum = verifyMiddle(middle);

		if(sum >= m){
		       	end = middle;
		}
		else{
		       	begin = middle;
		}
	}
	sum = verifyMiddle(end);
	if(sum != m) return -1;
	return end;
}

// Funcao principal
int main(int argc, char const *argv[]){

	long long int m;

	// Leitura do m
	scanf("%lld", &m);

	// Imprime o resultado obtido
	printf("%lld\n", computeN(m));

	return 0;
}

// 1493869633325

#include <bits/stdc++.h>
#define ll long long
#define MP make_pair
#define PB push_back
#define N 100009
#define MOD 1000000007
#define f first
#define s second
#define wt(x) cout << # x <<" = " << x << endl
#define FASTIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define inf 1e16
using namespace std;
void read(ll a= 0 )
{freopen("in","r",stdin);       if (a)  freopen("out","w",stdout); }
ll opnum ( ll n )
{

    ll ans = 0 ;
    for (ll i = 2 ; i < N  ; i ++ )
    {
        ll op = i * i * i ;

        if ( op > n )break ;
        ll lo = 0 , hi = MOD ;
        while ( lo < hi )
        {
            ll mid = ( lo + hi + 1 ) >> 1 ;
            if ( mid * op <= n )lo = mid ;
            else hi = mid - 1 ;
        }
        ans+= lo ;
    }
    return ans ;
}
int main ()
{

    ll m ;

    cin >> m ;
    ll lo  = 0 , hi = MOD * N ;
    while ( lo < hi )
    {
        ll mid  = ( lo + hi + 1 ) >> 1  ;
        if ( opnum ( mid ) <= m ) lo  = mid ;
        else hi = mid - 1 ;
    }
    ll newlo = 0 , newhi = lo ;
    while (newlo < newhi)
    {
        ll mid = ( newlo + newhi -1 ) >> 1 ;
        if ( opnum ( mid )== m )newhi = mid ;
        else newlo = mid + 1 ;
    }
    ll ans = newhi ;
    if ( opnum ( ans ) == m)cout << ans ;
    else cout << -1 ;

}