#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ss string
#define ll long long int
#define Endl endl
#define u_b upper_bound
#define rep(i,n)         for(int i=0;i<n;i++)
#define ld long double
#define tc long long t;cin>>t;while(t--)
#define fr(i,a,b)        for(long long int i=a;i<=b;i++)
#define E endl
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define V deque<ll>v;
#define aaste long long int n;cin>>n;long long int a[n];for(long long int i=0;i<n;i++)cin>>a[i];
const ll   mod=            1000000007;
const ll   MOD1=           (int)1e9 + 9;
const ll   MOD2=           998244353;
const ld    pi=             atan2(0, -1);
const ld    eps=            1e-9;
const int   N=                   1e6+7;
 
const int MAXR = 1000005;
ll         tests=          1;
 
using namespace std;
ll binarySearch(ll l, ll r,ll k)
{
  if (r >= l) {
    ll mid = l + (r - l) / 2;
    if (mid*(mid+1)==k)
      return 1;
    if (mid*(mid+1)>k)
      return binarySearch( l, mid - 1,k);
    return binarySearch(mid + 1, r, k);
  }
  return 0;
}
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
void swap(ll *p1, ll *p2)
{
   ll temp=*p1;
   *p1=*p2;
   *p2=temp;
}
ll cbratt(ll x)
{
    ll l = 0, r = MAXR;
    while (l != r) {
        ll m = (l + r + 1) / 2;
        if (m * m * m > x)
            r = m - 1;
        else
            l = m;
    }
    return l;
}
int MaxSubArraySumReturn(int a[], int  n) //negative thakle o kaaj korbe in O(n)
{
 
    int sum = 0, best = 0;
   for(ll i=0;i<n;i++)
    {
        sum = max(a[i], a[i] + sum);
        best = max(best, sum);
    }
    return best;
 
}
ll totalDigits(ll n) 
{ 
 
    ll number_of_digits = 0; 
    for (ll i = 1; i <= n; i *= 10) 
        number_of_digits += (n - i + 1); 
  
    return number_of_digits; 
}
//I used monotone algorith which I have taken from geeks for geeks
//NEHA mam dont send me plagarism mail.
//Arjun Arul sir please dont block my account.
//Shwetali mam please dont need to tell me to make submissions 
// article link : https://www.geeksforgeeks.org/convex-hull-monotone-chain-algorithm/
struct Point { 
  
    ll x, y; 
  
    bool operator<(Point p) 
    { 
        return x < p.x || (x == p.x && y < p.y); 
    } 
};
ll cross_product(Point O, Point A, Point B) 
{ 
    return (A.x - O.x) * (B.y - O.y) 
           - (A.y - O.y) * (B.x - O.x); 
}
deque<Point> convex_hull(deque<Point> A) 
{ 
    int n = A.size(), k = 0; 
  
    if (n <= 3) 
        return A; 
  
    deque<Point> ans(2 * n); 
    for (int i = 0; i < n; ++i) { 
        while (k >= 2 && cross_product(ans[k - 2],  
                          ans[k - 1], A[i]) <0) 
            k--; 
        ans[k++] = A[i]; 
    } 
    for (size_t i = n - 1, t = k + 1; i > 0; --i) { 
        while (k >= t && cross_product(ans[k - 2], 
                           ans[k - 1], A[i - 1]) < 0) 
            k--; 
        ans[k++] = A[i - 1]; 
    } 
    ans.resize(k - 1); 
  
    return ans; 
}
bool polarr(deque<Point>poly,Point p)
{
  ll n=poly.size();
  if(n<3)
    return false;
  else
  {
    for(ll i=0;i<n;i++)
    {
 
   ll temp=(p.x-poly[i].x)*(poly[(i + 1) % n].y-poly[i].y)-(p.y-poly[i].y)*(poly[(i + 1) % n].x-poly[i].x);
     if(temp>=0)
      return false;
    }
    return true;
  }
}
bool prime(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; 
} 
// C++ program to print all prime factors 
#include <bits/stdc++.h> 
using namespace std;
int main()
{
  #ifndef ONLINE_JUDGE
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    }
#endif
   ll a,b;
   cin>>a;
   cout<<(a)+(a*a)+(a*a*a);
    }

Measured memory_bytes: 3644