import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	}
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.Deque; Deque java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] input = scan.nextLine().split(" "); input scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " Deque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		} int i = 0; int i = 0; i 0 i < input.length i input.length input input.length i++ i++ i {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		} {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		} if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			} input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/") input[i].equals("*") input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/") input[i].equals("+") input[i].equals input[i] input i "+" input[i].equals("-") input[i].equals input[i] input i "-" input[i].equals("*") input[i].equals input[i] input i "*" input[i].equals("/") input[i].equals input[i] input i "/" {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} int b = stack.pop(); b stack.pop() stack.pop stack int a = stack.pop(); a stack.pop() stack.pop stack switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				} input[i] input i case "+": "+" case "+": stack.push(a + b) stack.push stack a + b a b break; case "-": "-" case "-": stack.push(a - b) stack.push stack a - b a b break; case "*": "*" case "*": stack.push(a * b) stack.push stack a * b a b break; case "/": "/" case "/": stack.push(a / b) stack.push stack a / b a b break; {
				stack.push(Integer.parseInt(input[i]));
			} stack.push(Integer.parseInt(input[i])) stack.push stack Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	}
} Main
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] input = scan.nextLine().split(" ");

		Deque<Integer> stack = new ArrayDeque<Integer>();

		for(int i = 0; i < input.length; i++) {
			if(input[i].equals("+") || input[i].equals("-")
					|| input[i].equals("*") || input[i].equals("/")) {
				int b = stack.pop();
				int a = stack.pop();
				switch(input[i]) {
				case "+":
					stack.push(a + b);
					break;
				case "-":
					stack.push(a - b);
					break;
				case "*":
					stack.push(a * b);
					break;
				case "/":
					stack.push(a / b);
					break;
				}

			} else {
				stack.push(Integer.parseInt(input[i]));
			}
		}
		System.out.println(stack.pop());
		scan.close();
	}
}
