import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  }
} Main public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  } main {
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int result = 0; result 0 for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	} int i = 1; int i = 1; i 1 i < 4 i 4 i++ i++ i {
    	result += Math.pow(a,i);
  	} {
    	result += Math.pow(a,i);
  	} result += Math.pow(a,i) result Math.pow(a,i) Math.pow Math a i System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main{
  public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  }
} public class Main{
  public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int result = 0;
    for(int i = 1;i < 4;i++){
    	result += Math.pow(a,i);
  	}
    System.out.println(result);
  }
}