import java.util.Scanner;

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

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