import java.util.Scanner;
import java.util.Stack;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	}
	public static void main(String[] args) {
		new Main().run();
	}
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	} run {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		} scan.hasNext() scan.hasNext scan {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		} String token = scan.next(); token scan.next() scan.next scan switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			} token case "+": "+" case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			} int v1 = stack.pop(); v1 stack.pop() stack.pop stack int v2 = stack.pop(); v2 stack.pop() stack.pop stack stack.push(v2 + v1) stack.push stack v2 + v1 v2 v1 break; case "-": "-" case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			} int v1 = stack.pop(); v1 stack.pop() stack.pop stack int v2 = stack.pop(); v2 stack.pop() stack.pop stack stack.push(v2 - v1) stack.push stack v2 - v1 v2 v1 break; case "*": "*" case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			} int v1 = stack.pop(); v1 stack.pop() stack.pop stack int v2 = stack.pop(); v2 stack.pop() stack.pop stack stack.push(v2 * v1) stack.push stack v2 * v1 v2 v1 break; default: default: {
				stack.push(Integer.valueOf(token));
				break;
			} stack.push(Integer.valueOf(token)) stack.push stack Integer.valueOf(token) Integer.valueOf Integer token break; System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (scan.hasNext()) {
			String token = scan.next();
			switch (token) {
			case "+": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 + v1);
				break;
			}
			case "-": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 - v1);
				break;
			}
			case "*": {
				int v1 = stack.pop();
				int v2 = stack.pop();
				stack.push(v2 * v1);
				break;
			}
			default: {
				stack.push(Integer.valueOf(token));
				break;
			}
			}
		}
		System.out.println(stack.pop());
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

