import java.util.*;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int num = sc.nextInt();
      	System.out.println(num+num*num+num*num*num);
    }
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int num = sc.nextInt();
      	System.out.println(num+num*num+num*num*num);
    }
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int num = sc.nextInt();
      	System.out.println(num+num*num+num*num*num);
    } main {
    	Scanner sc = new Scanner(System.in);
      	int num = sc.nextInt();
      	System.out.println(num+num*num+num*num*num);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc System.out.println(num+num*num+num*num*num) System.out.println System.out System System.out num+num*num+num*num*num num+num*num+num*num*num num num*num num num num*num*num num*num*num num num num String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int num = sc.nextInt();
      	System.out.println(num+num*num+num*num*num);
    }
}