import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		System.out.println(num + num*num + num*num*num);
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		System.out.println(num + num*num + num*num*num);
	}
} Main public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		System.out.println(num + num*num + num*num*num);
	} main {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		System.out.println(num + num*num + num*num*num);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan 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 public class Main {
	public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		System.out.println(num + num*num + num*num*num);
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		System.out.println(num + num*num + num*num*num);
	}
} Main
import java.io.IOException;
import java.util.Scanner;

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