import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	}
} Main public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	} main {
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String nf; nf nf = sc.nextLine() nf sc.nextLine() sc.nextLine sc String[] A = nf.split(" "); A nf.split(" ") nf.split nf " " int[] n = new int[A.length]; n new int[A.length] A.length A A.length int st = 0; st 0 for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		} int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		} {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		} if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			} A[i].equals("+") A[i].equals A[i] A i "+" {
				st--;
				n[st-1] = n[st-1] + n[st];
			} st-- st n[st-1] = n[st-1] + n[st] n[st-1] n st-1 st 1 n[st-1] + n[st] n[st-1] n st-1 st 1 n[st] n st if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			} A[i].equals("-") A[i].equals A[i] A i "-" {
				st--;
				n[st-1] = n[st-1] - n[st];
			} st-- st n[st-1] = n[st-1] - n[st] n[st-1] n st-1 st 1 n[st-1] - n[st] n[st-1] n st-1 st 1 n[st] n st if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			} A[i].equals("*") A[i].equals A[i] A i "*" {
				st--;
				n[st-1] = n[st-1] * n[st];
			} st-- st n[st-1] = n[st-1] * n[st] n[st-1] n st-1 st 1 n[st-1] * n[st] n[st-1] n st-1 st 1 n[st] n st {
				n[st] = Integer.parseInt(A[i]);
				st++;
			} n[st] = Integer.parseInt(A[i]) n[st] n st Integer.parseInt(A[i]) Integer.parseInt Integer A[i] A i st++ st System.out.println(n[st-1]) System.out.println System.out System System.out n[st-1] n st-1 st 1 String arg[] arg public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	}
} public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		String nf;
		nf = sc.nextLine();
		
		String[] A = nf.split(" ");
		int[] n = new int[A.length];
		int st = 0;

		for (int i=0; i<A.length; i++) {
			if(A[i].equals("+")){
				st--;
				n[st-1] = n[st-1] + n[st];
			} else if (A[i].equals("-")){
				st--;
				n[st-1] = n[st-1] - n[st];
			} else if (A[i].equals("*")){
				st--;
				n[st-1] = n[st-1] * n[st];
			} else {
				n[st] = Integer.parseInt(A[i]);
				st++;
			}
		}
		System.out.println(n[st-1]);
	}
}
