import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	} main {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String symbol; symbol ArrayDeque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		} sc.hasNext() sc.hasNext sc {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		} symbol = sc.next() symbol sc.next() sc.next sc if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			} symbol.equals("+") symbol.equals symbol "+" {
				stack.push(stack.pop() + stack.pop());
			} stack.push(stack.pop() + stack.pop()) stack.push stack stack.pop() + stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			} symbol.equals("-") symbol.equals symbol "-" {
				stack.push((stack.pop() * -1) + stack.pop());
			} stack.push((stack.pop() * -1) + stack.pop()) stack.push stack (stack.pop() * -1) + stack.pop() (stack.pop() * -1) stack.pop() stack.pop stack -1 1 stack.pop() stack.pop stack if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			} symbol.equals("*") symbol.equals symbol "*" {
				stack.push(stack.pop() * stack.pop());
			} stack.push(stack.pop() * stack.pop()) stack.push stack stack.pop() * stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack {
				stack.push(Integer.parseInt(symbol));
			} stack.push(Integer.parseInt(symbol)) stack.push stack Integer.parseInt(symbol) Integer.parseInt Integer symbol System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String symbol;
		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

		while (sc.hasNext()) {
			symbol = sc.next();
			
			if(symbol.equals("+")){
				stack.push(stack.pop() + stack.pop());
			} else if (symbol.equals("-")){
				stack.push((stack.pop() * -1) + stack.pop());
			} else if (symbol.equals("*")){
				stack.push(stack.pop() * stack.pop());
			} else {
				stack.push(Integer.parseInt(symbol));
			}
		}
		System.out.println(stack.pop());
	}
}