#include <bits/stdc++.h>
#define ll long long
#define debug()
using namespace std;
/*
   1 WATERMELON 
            ll n;
            cin>>n;
            if(n&1 || n==2)cout<<"NO\n";
            else cout<<"YES\n";
    2 STRING TOO LONG
             int n;
        cin>>n;
        while(n--){
            string name;
            cin>>name;
            if(name.size()<=10)cout<<name<<endl;
            else cout<<name[0]<<name.size()-2<<name[name.size()-1]<<endl;
            
    3> STRING GAME
                 string name;
                    cin>>name;
                    string ans="";
                    for(auto x : name){
                        if(x=='a'|| x=='e'|| x=='i'|| x=='o'|| x=='u'|| x=='A'|| x=='E'|| x=='I'|| x=='O'|| x=='U'|| x=='y'||x=='Y')continue;
                        else {
                            if((int)x>=97)ans+='.',ans+=x;
                            else ans+='.',ans+=(char)((int)x +32);
                        }

                    } cout<<ans<<endl;

            



    4> PETYA AND STRING
                string a,b;
            cin>>a>>b;
            for(int i=0;i<a.size();i++){
                if((int)a[i]<97)a[i]=(char)((int)a[i]+32);
            }
             for(int i=0;i<b.size();i++){
                if((int)b[i]<97)b[i]=(char)((int)b[i]+32);
            }
            if(a==b)cout<<0<<endl;
          if(a<b)cout<<-1<<endl;
          if(a>b) cout<<1<<endl;

            }
    5> HELPFUL MATHS
                 string name;
                cin>>name;
                std::vector<int> v;
                for(auto x : name){
                    if(x>=48 && x<=57)v.push_back(x-'0');
                }
                sort(v.begin(), v.end());
                for(int i=0;i<v.size();i++){
                        if(i==v.size()-1)cout<<v[i]<<endl;
                        else {
                            cout<<v[i]<<"+";
                        }

                }

    6 > TWINS
            int n;
            cin>>n;
            std::vector<int> v;
            ll sum=0,sum1=0;
            for(int i=0;i<n;i++){
                int x;
                cin>>x;
                v.push_back(x);
                sum+=x;
            }
            sort(v.rbegin(),v.rend());
            int ans=0;
            for(int i=0;i<v.size();i++){
                if(sum1>sum){break;}
                else {
                    ans=i;
                    sum1+=v[i];
                    sum-=v[i];
                }

            }
        cout<<ans+1<<endl;

    7 > CHAT ROOM 
                     string name;
                        cin>>name;
                        std::vector<char> v;
                        int cnt=0;
                        for(int i=0;i<name.size();i++){
                          
                            if(v.empty() && name[i]=='h')v.push_back('h');
                            if(!v.empty()){
                              if(v.back()=='h'&& name[i]=='e')v.push_back('e');
                                 else if(v.back()=='e'&& name[i]=='l')v.push_back('l'),cnt=1;
                                    else if(v.back()=='l'&& name[i]=='l' && cnt==1)v.push_back('l'),cnt=2;
                                        else if(v.back()=='l'&& cnt==2 && name[i]=='o')v.push_back('o');
                                            else continue;
                        }
                        }
                       //A for(auto x : v)cout<<x<<endl;
                        std::vector<char> v1={'h','e','l','l','o'};
                        if(v==v1)cout<<"YES\n";
                        else cout<<"NO\n";

  8> LUCKY NUMBER

                    
            bool isluckyagain(int n){
                if(n%47==0 || n%447==0||n%474==0||n%74==0 || n%477==0 || n%477==0 || n%747==0|| n%477==0||n%744==0||n%774==0)return true;
                else return false;
            }
            bool islucky(int n){
                while(n){
                    int x=n%10;
                      n/=10;
                    if(x!=7){
                        if(x!=4)return false;
                     
                    }
                     if(x!=4){
                        if(x!=7)return false;
                        
                    }

                  
                }
             
                return true;
            }
            int main(){
            #ifndef ONLINE_JUDGE
                freopen("input.txt","r",stdin);
                freopen("output.txt","w",stdout);
            #endif
                int n;
                cin>>n;
                if(n%4==0 || n%7==0 || islucky(n) || isluckyagain(n)){
                        cout<<"YES\n";
                }   
                else cout<<"NO\n";

            return 0;
            }

    9> PRESENT
                    int n;
               cin>>n;
               std::vector<int> v(n);
              

               for(auto & x : v)cin>>x;
                std::vector<int>ans(n);
                
               
                for(int i=0;i<n;i++){
                    ans[v[i]-1]=i+1;
                }
              
                for(auto x : ans)cout<<x<<" ";
                   
               cout<<endl;
    10> BEAUTIFUL MATRIX
                   int ar[5][5];
                   int x,y;
                   for(int i=0;i<5;i++)
                        for(int j=0;j<5;j++){
                            cin>>ar[i][j];
                            if(ar[i][j]==1){
                                 x=i+1,y=j+1;
                            }
                        }
                    int fx=3,fy=3;
                    int t=abs(fx-x)+abs(fy-y);
                    cout<<t<<endl;
    11> ARRIVAL OF GENERAL
             int n;
                cin>>n;
                std::vector<int> v(n);
                for(auto &x: v)cin>>x;
                int min_index=0,max_index=0,ma=-1,mi=100000,prev1=ma,prev=mi;
                for(int i=0;i<v.size();i++){
                    if(v[i]==mi)min_index=i;
                    mi=min(mi,v[i]);
                    if(mi!=prev)min_index=i,prev=mi;
                    ma=max(ma,v[i]);
                    if(ma!=prev1)max_index=i;prev1=ma;
                }
                
                int t;
                if(max_index<min_index){
                    t=max_index+(v.size()-min_index-1);

                }
                else{
                    t=max_index-1+v.size()-min_index-1;
                }

            cout<<t<<endl;
    12>GAME WiTH STICK
           int n,m;
           cin>>n>>m;
           int s=min(n,m);
           if(s&1){
            puts("Akshat\n");
           }
           else {
            puts("Malvika\n");
           }





           int n,m;
        cin>>n>>m;
        int cnt=0;
        if(m%n==0){
            while(m!=n){
                if(m%3==0)m/=3;
                else if(m%2==0)m/=2;
                cnt++;
            }
            cout<<cnt<<endl;
        }
        else cout<<-1<<endl;
*/

int main(){
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
            
            int a;
            cin>>a;
            long long c=a+a*a+a*a*a;
            cout<<c;
return 0;
}

Measured memory_bytes: 3580