import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) short a = Short.parseShort(br.readLine()); a Short.parseShort(br.readLine()) Short.parseShort Short br.readLine() br.readLine br System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3))) System.out.print System.out System System.out (short) (a + Math.pow(a, 2) + Math.pow(a, 3)) a + Math.pow(a, 2) + Math.pow(a, 3) a Math.pow(a, 2) Math.pow Math a 2 Math.pow(a, 3) Math.pow Math a 3 String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		short a = Short.parseShort(br.readLine());
		System.out.print((short) (a + Math.pow(a, 2) + Math.pow(a, 3)));
	}
}
