#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e18+7;
const ll MOD=1000000007;

class Long{
private:
    typedef unsigned long ul;
    //true::+ false::-
    bool sign;
    //left::small right::big
    deque<bool> N;
    
    void clean(){
        while(N.size()>0 && N[N.size()-1]==false){
            N.pop_back();
        }
    }
    
public:
    Long(deque<bool> N={},bool sign=true):N(N),sign(sign){clean();}
    
    Long(ll n){
        sign=true;
        if(n<0){sign=false; n*=-1;}
        for(int i=0;i<63;i++){
            N.push_back(n>>i&1);
        }
        clean();
    }
    
    bool & operator [] (ul k){
        assert(k<N.size());
        return N[k];
    }
    
    Long operator << (ul k){
        Long ret(N);
        for(ul i=0;i<k;i++){
            ret.N.push_front(false);
        }
        return ret;
    }
    
    Long operator >> (ul k){
        Long ret(N);
        for(ul i=0;i<k && ret.size()>0;i++){
            ret.N.pop_front();
        }
        return ret;
    }
    
    bool operator < (Long a){
        Long l(N,sign);
        if(a==l){return false;}
        if(a.sign==true && sign==true){
            if(a.size()>N.size()){return true;}
            if(a.size()<N.size()){return false;}
            for(ll i=a.size()-1;i>=0;i--){
                if(a[i]==N[i]){continue;}
                if(a[i]){return true;}
                return false;
            }
            return false;
        }
        if(a.sign==true && sign==false){
            return true;
        }
        if(a.sign==false && sign==true){
            return false;
        }
        if(a.sign==false && sign==false){
            if(a.size()<N.size()){return true;}
            if(a.size()>N.size()){return false;}
            for(ll i=a.size()-1;i>=0;i--){
                if(a[i]==N[i]){continue;}
                if(a[i]){return false;}
                return true;
            }
        }
        return false;
    }
    
    bool operator > (Long a){
        Long l(N,sign);
        return a<l;
    }
    
    bool operator == (Long a){
        if(a.size()!=N.size()){return false;}
        if(a.size()==0){return true;}
        if(a.sign!=sign){return false;}
        for(int i=0;i<a.size();i++){
            if(a[i]!=N[i]){return false;}
        }
        return true;
    }
    
    Long operator + (Long a){
        Long l(N,sign);
        ll mx=max(l.size(),a.size())+1;
        if(a.sign==l.sign){
            a.resize(mx);
            l.resize(mx);
            bool k=false;
            for(ul i=0;i<mx;i++){
                int count=0;
                if(a[i]){count++;}
                if(l[i]){count++;}
                if(k){count++;}
                a[i]=count%2;
                k=count/2;
            }
            a.clean();
            return a;
        }
        if(a.sign==true){swap(l,a);}
        if(l==re_sign(a)){return Long();}
        if(l>re_sign(a)){
            bool k=false;
            l.resize(mx);
            a.resize(mx);
            for(ul i=0;i<mx;i++){
                int count=0;
                if(l[i]){count++;}
                if(a[i]){count--;}
                if(k){count--;}
                l[i]=count%2;
                if(count<0){k=true;}
                else{k=false;}
            }
            l.clean();
            return l;
        }
        bool k=false;
        l.resize(mx);
        a.resize(mx);
        for(ul i=0;i<mx;i++){
            int count=0;
            if(a[i]){count++;}
            if(l[i]){count--;}
            if(k){count--;}
            a[i]=count%2;
            if(count<0){k=true;}
            else{k=false;}
        }
        a.clean();
        return a;
    }
    
    Long operator - (Long a){
        Long l(N,sign);
        return l+re_sign(a);
    }
    
    Long operator * (Long a){
        Long l(N,sign);
        Long ret(0);
        for(ll i=0;i<a.size();i++){
            if(a[i]){
                ret=ret+(l<<i);
            }
        }
        return ret;
    }
    
    Long re_sign(Long a){a.sign=!a.sign; return a;}
    
    ul size(){return N.size();}
    
    void resize(ul k){N.resize(k);}
    
    void clear(){
        sign=true;
        N.clear();
    }
    
    ll out(){
        ll k=0;
        ll a=1;
        for(int i=0;i<N.size();i++){
            if(N[i]){k+=a;}
            a*=2;
        }
        if(!sign){k*=-1;}
        return k;
    }
};


int main(){
    ll n;
    cin>>n;
    Long L(n);
    L=L*L*L;
    cout<<L.out()<<endl;
    return 0;
}



Measured memory_bytes: 3112