import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	}

}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	}

} Main public static void main(String[] args) {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	} main {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	} java.util.Stack<Integer> stack = new java.util.Stack<Integer>(); stack new java.util.Stack<Integer>() int a = 0 a 0 b = 0; b 0 String[] c; c Scanner sc = new Scanner(System.in); sc new Scanner(System.in) c = sc.nextLine().split(" ") c sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		} int i = 0; int i = 0; i 0 i < c.length i c.length c c.length i++ i++ i {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		} {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		} if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			} c[i].equals("+") c[i].equals c[i] c i "+" {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} int o2 = stack.pop(); o2 stack.pop() stack.pop stack int o1 = stack.pop(); o1 stack.pop() stack.pop stack stack.push(o1 + o2) stack.push stack o1 + o2 o1 o2 if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			} c[i].equals("-") c[i].equals c[i] c i "-" {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} int o2 = stack.pop(); o2 stack.pop() stack.pop stack int o1 = stack.pop(); o1 stack.pop() stack.pop stack stack.push(o1 - o2) stack.push stack o1 - o2 o1 o2 if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			} c[i].equals("*") c[i].equals c[i] c i "*" {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} int o2 = stack.pop(); o2 stack.pop() stack.pop stack int o1 = stack.pop(); o1 stack.pop() stack.pop stack stack.push(o1 * o2) stack.push stack o1 * o2 o1 o2 {
				stack.push(Integer.parseInt(c[i]));
			} stack.push(Integer.parseInt(c[i])) stack.push stack Integer.parseInt(c[i]) Integer.parseInt Integer c[i] c i 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) {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	}

} public class Main {

	public static void main(String[] args) {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		java.util.Stack<Integer> stack = new java.util.Stack<Integer>();
		int a = 0, b = 0;
		String[] c;
		Scanner sc = new Scanner(System.in);
		c = sc.nextLine().split(" ");

		for (int i = 0; i < c.length; i++) {
			if (c[i].equals("+")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 + o2);
			} else if (c[i].equals("-")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 - o2);
			} else if (c[i].equals("*")) {
				int o2 = stack.pop();
				int o1 = stack.pop();
				stack.push(o1 * o2);
			} else {
				stack.push(Integer.parseInt(c[i]));
			}
		}
		System.out.println(stack.pop());

	}

}

