import java.util.Scanner;

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

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