import java.util.Scanner;

public class Main {
	public static int top = 0;
	public static int[] stack = new int[200];
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[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[200];
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[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[200]; stack new int[200] 200 public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		}
		
		System.out.println(pop());
	} main {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		}
		
		System.out.println(pop());
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String[] k = (stdIn.nextLine()).split(" "); k (stdIn.nextLine()).split(" ") (stdIn.nextLine()).split (stdIn.nextLine()) stdIn.nextLine stdIn " " for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		} int i = 0; int i = 0; i 0 i < k.length i k.length k k.length i++ i++ i {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		} {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		} if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i])); k[i].equals("+") k[i].equals k[i] k i "+" {
				int b = pop();
				int a = pop();
				push(a + b);
			} int b = pop(); b pop() pop int a = pop(); a pop() pop push(a + b) push a + b a b if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i])); k[i].equals("-") k[i].equals k[i] k i "-" {
				int b = pop();
				int a = pop();
				push(a - b);
			} int b = pop(); b pop() pop int a = pop(); a pop() pop push(a - b) push a - b a b if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i])); k[i].equals("*") k[i].equals k[i] k i "*" {
				int b = pop();
				int a = pop();
				push(a * b);
			} int b = pop(); b pop() pop int a = pop(); a pop() pop push(a * b) push a * b a b push(Integer.parseInt(k[i])) push Integer.parseInt(k[i]) Integer.parseInt Integer k[i] k 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[200];
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[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[200];
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[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[200];
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String[] k = (stdIn.nextLine()).split(" ");
		
		for (int i = 0; i < k.length;i++) {
			if (k[i].equals("+")) {
				int b = pop();
				int a = pop();
				push(a + b);
			}
			else if (k[i].equals("-")) {
				int b = pop();
				int a = pop();
				push(a - b);
			}
			else if (k[i].equals("*")) {
				int b = pop();
				int a = pop();
				push(a * b);
			}
			else
				push(Integer.parseInt(k[i]));
		}
		
		System.out.println(pop());
	}
	
	public static void push(int x) {
		stack[++top] = x;
	}
	
	public static int pop() {
		top--;
		return stack[top+1];
	}
}