import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static int top = 0;

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	}

	public static void push(int[] stack,int num){
		top++;
		stack[top] = num;
	}

	public static int pop(int[] stack){
		return stack[top--];
	}


} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	static int top = 0;

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	}

	public static void push(int[] stack,int num){
		top++;
		stack[top] = num;
	}

	public static int pop(int[] stack){
		return stack[top--];
	}


} Main static int top = 0; top 0 public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	} main {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	} BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) String[] array = r.readLine().split(" "); array r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " int[] stack = new int[array.length]; stack new int[array.length] array.length array array.length for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		} {
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		} String temps = array[i]; temps array[i] array i int x x y = 0; y 0 switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			} temps case "+": "+" case "+": x = pop(stack) x pop(stack) pop stack y = pop(stack) y pop(stack) pop stack push(stack,y + x) push stack y + x y x break; case "-": "-" case "-": x = pop(stack) x pop(stack) pop stack y = pop(stack) y pop(stack) pop stack push(stack,y - x) push stack y - x y x break; case "*": "*" case "*": x = pop(stack) x pop(stack) pop stack y = pop(stack) y pop(stack) pop stack push(stack,y * x) push stack y * x y x break; default: default: push(stack,Integer.parseInt(temps)) push stack Integer.parseInt(temps) Integer.parseInt Integer temps break; System.out.println(stack[top]) System.out.println System.out System System.out stack[top] stack top String[] args args public static void push(int[] stack,int num){
		top++;
		stack[top] = num;
	} push {
		top++;
		stack[top] = num;
	} top++ top stack[top] = num stack[top] stack top num int[] stack stack int num num public static int pop(int[] stack){
		return stack[top--];
	} pop {
		return stack[top--];
	} return stack[top--]; stack[top--] stack top-- top int[] stack stack public class Main {

	static int top = 0;

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	}

	public static void push(int[] stack,int num){
		top++;
		stack[top] = num;
	}

	public static int pop(int[] stack){
		return stack[top--];
	}


} public class Main {

	static int top = 0;

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	}

	public static void push(int[] stack,int num){
		top++;
		stack[top] = num;
	}

	public static int pop(int[] stack){
		return stack[top--];
	}


} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static int top = 0;

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] array = r.readLine().split(" ");
		int[] stack = new int[array.length];


		for(int i = 0; i < array.length; i++){
			String temps = array[i];
			int x,y = 0;
			switch(temps){
				case "+":
					x = pop(stack);
					y = pop(stack);
					push(stack,y + x);
					break;
				case "-":
					x = pop(stack);
					y = pop(stack);
					push(stack,y - x);
					break;
				case "*":
					x = pop(stack);
					y = pop(stack);
					push(stack,y * x);
					break;
				default:
					push(stack,Integer.parseInt(temps));
					break;
			}
		}
		System.out.println(stack[top]);
	}

	public static void push(int[] stack,int num){
		top++;
		stack[top] = num;
	}

	public static int pop(int[] stack){
		return stack[top--];
	}


}