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