#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;

		ll int n;
		cin>>n;
		
		int a=pow(n,2);
		int b=pow(n,3);
		cout<<a+b+n;
	

	
}



#include <iostream>

int main() {
  int a; std::cin >> a;
  int sum = a;
  sum += a*a + a*a*a;
  std::cout << sum << std::endl;
  
  return 0;
} 