import java.util.Scanner;
public class Main {
	public static int top = 0;
	public static int[] stack = new int[10000];
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	}
	
	public static void push(int x){
		stack[++top] = x;
	}
	
	public static int pop(){
		top--;
		return stack[top+1];
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static int top = 0;
	public static int[] stack = new int[10000];
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	}
	
	public static void push(int x){
		stack[++top] = x;
	}
	
	public static int pop(){
		top--;
		return stack[top+1];
	}
} Main public static int top = 0; top 0 public static int[] stack = new int[10000]; stack new int[10000] 10000 public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	} main {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	} int a a b; b String[] s = (sc.nextLine()).split(" "); s (sc.nextLine()).split(" ") (sc.nextLine()).split (sc.nextLine()) sc.nextLine sc " " for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		} {
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		} if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			} s[i].equals("+") s[i].equals s[i] s i "+" {
				a = pop();
				b = pop();
				push(b + a);
			} a = pop() a pop() pop b = pop() b pop() pop push(b + a) push b + a b a if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			} s[i].equals("-") s[i].equals s[i] s i "-" {
				a = pop();
				b = pop();
				push(b - a);
			} a = pop() a pop() pop b = pop() b pop() pop push(b - a) push b - a b a if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			} s[i].equals("*") s[i].equals s[i] s i "*" {
				a = pop();
				b = pop();
				push(b * a);
			} a = pop() a pop() pop b = pop() b pop() pop push(b * a) push b * a b a {
				push(Integer.parseInt(s[i]));
			} push(Integer.parseInt(s[i])) push Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i System.out.println(pop()) System.out.println System.out System System.out pop() pop String[] args args public static void push(int x){
		stack[++top] = x;
	} push {
		stack[++top] = x;
	} stack[++top] = x stack[++top] stack ++top top x int x x public static int pop(){
		top--;
		return stack[top+1];
	} pop {
		top--;
		return stack[top+1];
	} top-- top return stack[top+1]; stack[top+1] stack top+1 top 1 public class Main {
	public static int top = 0;
	public static int[] stack = new int[10000];
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	}
	
	public static void push(int x){
		stack[++top] = x;
	}
	
	public static int pop(){
		top--;
		return stack[top+1];
	}
} public class Main {
	public static int top = 0;
	public static int[] stack = new int[10000];
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	}
	
	public static void push(int x){
		stack[++top] = x;
	}
	
	public static int pop(){
		top--;
		return stack[top+1];
	}
} Main
import java.util.Scanner;
public class Main {
	public static int top = 0;
	public static int[] stack = new int[10000];
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a, b;
		String[] s = (sc.nextLine()).split(" ");
		
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("+")){
				a = pop();
				b = pop();
				push(b + a);
			}
			else if(s[i].equals("-")){
				a = pop();
				b = pop();
				push(b - a);
			}
			else if(s[i].equals("*")){
				a = pop();
				b = pop();
				push(b * a);
			}
			else{
				push(Integer.parseInt(s[i]));
			}
		}
		System.out.println(pop());
	}
	
	public static void push(int x){
		stack[++top] = x;
	}
	
	public static int pop(){
		top--;
		return stack[top+1];
	}
}
