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

    private static long equationOutput(int a) {

        if(a == 0) {
            return 0;
        }
        long sum = 0;
        if(a != 1) {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } else {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        }

        return sum;
    }
} import java.util.Scanner; Scanner java.util class Main {
    static Scanner scan = new Scanner(System.in);
    public static void main(String[] args) {
        int a = scan.nextInt();
        System.out.println(equationOutput(a));
    }

    private static long equationOutput(int a) {

        if(a == 0) {
            return 0;
        }
        long sum = 0;
        if(a != 1) {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } else {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        }

        return sum;
    }
} Main static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args) {
        int a = scan.nextInt();
        System.out.println(equationOutput(a));
    } main {
        int a = scan.nextInt();
        System.out.println(equationOutput(a));
    } int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan System.out.println(equationOutput(a)) System.out.println System.out System System.out equationOutput(a) equationOutput a String[] args args private static long equationOutput(int a) {

        if(a == 0) {
            return 0;
        }
        long sum = 0;
        if(a != 1) {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } else {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        }

        return sum;
    } equationOutput {

        if(a == 0) {
            return 0;
        }
        long sum = 0;
        if(a != 1) {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } else {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        }

        return sum;
    } if(a == 0) {
            return 0;
        } a == 0 a 0 {
            return 0;
        } return 0; 0 long sum = 0; sum 0 if(a != 1) {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } else {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        } a != 1 a 1 {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1); gp (a * ((long)Math.pow(a, 3) - 1)) / (a - 1) (a * ((long)Math.pow(a, 3) - 1)) a ((long)Math.pow(a, 3) - 1) (long)Math.pow(a, 3) Math.pow Math a 3 1 (a - 1) a 1 sum = gp sum gp {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        } sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3) sum a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3) a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3) a (long)Math.pow(a, 2) Math.pow Math a 2 (long)Math.pow(a, 3) Math.pow Math a 3 return sum; sum int a a
import java.util.Scanner;
class Main {
    static Scanner scan = new Scanner(System.in);
    public static void main(String[] args) {
        int a = scan.nextInt();
        System.out.println(equationOutput(a));
    }

    private static long equationOutput(int a) {

        if(a == 0) {
            return 0;
        }
        long sum = 0;
        if(a != 1) {
            long gp =  (a * ((long)Math.pow(a, 3) - 1)) / (a - 1);
            sum = gp;
        } else {
            sum = a + (long)Math.pow(a, 2) + (long)Math.pow(a, 3);
        }

        return sum;
    }
}
