// warm heart, wagging tail,and a smile just for you!
//                         _ _ _ __ __ __  __ _ _ __ _ _ __ _ __ ____ _ _ _ _ _ _ _ _ 
//                          ||__|| || ||\\//||  //__\\  ||\\ || ||__   ||__||  ||  ||
//                          ||  || || ||    || //    \\ || \\||  ___|| ||  ||  \\__//
//                                                    _ ___ _ _ _ _  _ __ _ _ __ _ __ _ __ _ _ __ ___ __ _ _ _ _ ___ _ _ ___
//                                                    ||__   ||__||  //__\\  ||\\ || ||// ||__|| ||  ]] ||__||  //__\\  ||__))
//                                                    ____|| ||  || //    \\ || \\|| ||\\ ||  || ||__]] ||  || //    \\ || \\
//                                                                     ¦¦¦¦¦¦¦¦¦¦¦
//                                                                   ¦¦¦++++++++++¦¦¦
//                                                                ¦¦¦+++++¦¦¦¦++++++¦¦¦
//                                            ¦¦¦¦¦¦¦¦¦¦¦       ¦¦+++++¦¦¦¦++¦¦¦¦+++++¦¦
//                                      ¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦++++++¦¦¦+++++¦¦
//                               ¦¦¦¦¦¦¦¦++++++++++++++++++++++¦¦¦¦¦¦¦¦¦++++++¦¦+++++++¦¦
//                             ¦¦¦¦+¦¦+++++++++++++++++++++++++++++¦¦¦¦¦¦¦¦¦+++++++++++¦¦                 
//                           ¦¦¦+++¦++++++++++++++++++++++++++++++++++++¦¦++¦¦¦+++++++¦¦¦¦¦                                        
//                         ¦¦¦+++++++++++++++++++++++++++++++++++++++++++¦¦+++¦¦¦¦¦¦¦¦+++++¦¦                             
//                       ¦¦¦++++++++++++++++++++++++++++++++++++++++++++++++++++¦¦¦+++++++++¦¦¦              
//                     ¦¦¦++++++++++++++++++++++++++++++++++++++++++++++++++++++++¦¦¦¦¦+++++++¦¦             
//                 ¦¦¦¦++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++¦¦¦¦+++++¦¦¦¦
//     ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦+++++¦¦¦¦+++++++++++++++++¦¦¦¦¦+++++++++++++++++++++++++++¦¦¦++++¦¦¦¦¦¦            
//   ¦¦¦¦+++++++++++++++++++¦¦++¦¦¦¦¦¦+++++++++++++++++++++¦¦¦¦¦¦+++++++¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦+++¦¦+++¦¦
// ¦¦¦++++++++++++++++++++¦¦+++++++++++++++++¦¦+++++++++++++++++++++¦¦¦¦+++++++++++¦+++++++¦¦++++++++¦¦
// ¦¦+++++++++++++++++++++¦¦++++¦¦¦¦¦¦+++¦¦¦¦++¦¦¦¦+++++++¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++++++¦¦+++++++¦¦¦
// ¦¦+++++++++++++++++++++¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦¦¦¦¦++++++++++++++++++++++++¦¦++++¦¦¦¦¦
// ¦¦¦++++++++++++++++++¦¦¦+++++¦¦++++++++++++++++++++++++++++¦¦¦¦¦++++++++++++++++++++++++¦¦¦¦¦¦¦¦
//   ¦¦¦+++++++++++++¦¦¦¦¦++++++++¦¦++++++++++++++++++++++++¦¦¦++¦¦+++++++++++++++++++++++¦¦
//       ¦¦¦¦¦¦¦¦¦¦¦¦¦¦  ¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦+++++++++++++++++++¦¦¦¦
//                         ¦¦¦¦¦¦¦                           ¦¦¦¦¦  ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
//
#include<boost/multiprecision/cpp_int.hpp>
#include<bits/stdc++.h>
#define lli long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define test lli t;cin>>t;while(t--)
#define arrin lli n;cin>>n;lli a[n];for(lli i=0;i<n;i++)cin>>a[i]       // a%b=a-b*floor(a/b);
#define floop for(lli i=0;i<n;i++)
#define mod 1000000007
#define defvec vector<lli>v
#define ub upper_bound
#define pb push_back
#define bs binary_search
#define INF ll(8230219982008199610)
#define MINF ll(-8230219982008199610)
#define INT_BITS 16
#define ones(n) __builtin_popcountll(n)
#define focc(n) __builtin_ffsll(n) //to count index of first 1 from right in binary representation of a number starting from index 1
#define leadingzero(n) __builtin_clzll(n)
#define trailingzeroes(n) __builtin_ctzll(n)
//string s=R"(HIMANS&\nSHAN\t)"; we can print a whole string same as given by doing this
//vector<int>v={1,2,3,4};
//vector<int>w=move(v);
//after this v={};
//w={1,2,3,4};
// to reverse a string reverse(str.begin(), str.end());
//  OR
// string rev = string(str.rbegin(),str.rend());
#define loop0(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define rev0(i,n)  for(int i=n-1; i>=0; i--)
#define rev1(i,n)  for(int i=n; i>0; i--)
using ll=long long;
using namespace boost::multiprecision ;
using namespace std;
unsigned short leftRotate(unsigned short n, unsigned short d) 
{ 
    return (n << d)|(n >> (INT_BITS - d)); 
} 
unsigned short rightRotate(unsigned short n,unsigned short d) 
{ 
    return (n >> d)|(n << (INT_BITS - d)); 
} 
  
lli issorted(lli a[],lli n)
{
    if(n==1)
    return 1;
    return (a[n-1]<a[n-2])?0:issorted(a,n-1);
}
lli count(string s)//count distinct element in string
{
    lli ans=1,i,j;
    for(i=1;i<s.length();i++)
    {
        for(j=0;j<i;j++)
        {
            if(s[i]==s[j])
            break;
        }
        if(i==j)
        ans++;
    }
    return ans;
}
bool check(int N)
    {   lli i;
        if( N & (1 << i) )
            return true;
        else
            return false;
    }
bool isvowel(char ch)
{
    string s = "aeiouAEIOU";
    for (char c : s)
    {
        if (c == ch)
        {
            return true;
        }
    }
    return false;
}
bool isPrime(lli n) 
{ 
    if(n<=1)  return false; 
    if(n<=3)  return true; 
    if(n%2==0||n%3==0) return false; 
    for(lli i=5; i*i<=n; i=i+6) 
    if (n%i == 0 || n%(i+2) == 0) 
    return false; 
    return true; 
}
struct interval

{
    int start,end;
   
 
};

bool compare(interval x,interval y)

{
    return (x.start<y.start);
}
bool isSubstring(string s1, string s2) 
{ 
    int M = s1.length(); 
    int N = s2.length(); 
  
    /* A loop to slide pat[] one by one */
    for (int i = 0; i <= N - M; i++) { 
        int j; 
  
        /* For current index i, check for 
 pattern match */
        for (j = 0; j < M; j++) 
            if (s2[i + j] != s1[j]) 
                break; 
  
        if (j == M) 
            return true; 
    } 
  
    return false; 
} 

int seive(int n)  //to count number of primes from 1 to n
{
   
bool isprime[n+1];
    
for(int i=2;i<=n;i++)
    
isprime[i]=true;
    
isprime[0]=false;
    
isprime[1]=false;
    
for(int i=2;i<=sqrt(n);i++)
    
{   
if(isprime[i]==true)
       
{
           
for(int j=i*i;j<=n;j+=i)
        
{
           
isprime[j]=false;
               
}

}
      
    
}
    
int count=0;
    
for(int i=0;i<=n;i++)
    
{
        
if(isprime[i]==true)
        
count++;
    
}
    
return count;

}


void multiply(int a[2][2],int m[2][2])

{                                                 //
int him[2][2];
                                    //   MATRIX EXPONENTIATION
for(int i=0;i<2;i++)
                              //
{   
                                              //
for(int j=0;j<2;j++)
        
{   him[i][j]=0;
            
for(int k=0;k<2;k++)
            
{
                
him[i][j]+=(a[i][k]*m[k][j]);
            
}
            
        
}
    
}
    
for(int i=0;i<2;i++)
    
{
        for(int j=0;j<2;j++)
        
{
            a[i][j]=him[i][j];
        
}
    
}
}

void power(int a[2][2],int n)

{   if(n==0||n==1)
    
return;
    
power(a,n/2);
    
multiply(a,a);
    
if(n%2!=0)
    
{  
int m[2][2]={{1,1},{1,0}};
        
multiply(a,m);
    
}

}

int fib(int n)

{
    
int a[2][2]={{1,1},{1,0}};
    
if(n==0)
    
return 0;
    
power(a,n-1);
    
return a[0][0];

}


int factmod(int n, int p)   //to calculate (n!)%p
{
    
int res = 1;
    
while (n > 1) 
{
        
res = (res * ((n/p) % 2 ?  p-1 : 1)) % p;
        
for (int i = 2; i <=(n%p);i++)
            
res = (res * i) % p;
        
n /= p;
    
}
    
return res % p;

}
int bubblesort(int a[],int n)
{
for (int i = 0; i < n; i++) {
for (int j = 0; j < n-1; j++) {
if (a[j] > a[j+1]) {
swap(a[j],a[j+1]);
} 
} 
}
}
lli modularexponentiation(lli a,lli n) 
{ 
    lli res = 1;      
   
    while (n > 0) 
    { 
        if (n& 1) 
            res = ((res%mod)*(a%mod))%mod; 
        n/=2; 
        a=((a%mod)*(a%mod))%mod;
    } 
    return res; 
}
int main()
{
fastio;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
lli n;
cin>>n;
lli sum=n+(n*n)+(n*n*n);
cout<<sum<<endl;
}

Measured memory_bytes: 3692