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

public class Main {

	public static void main(String args[]) {
		new Main().solve();
	}
	void solve() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		}
		System.out.println(stack.pop());
	}
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static void main(String args[]) {
		new Main().solve();
	}
	void solve() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		}
		System.out.println(stack.pop());
	}
} Main public static void main(String args[]) {
		new Main().solve();
	} main {
		new Main().solve();
	} new Main().solve() new Main().solve new Main() String args[] args void solve() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		}
		System.out.println(stack.pop());
	} solve {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				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>() String[] strArray = scan.nextLine().split(" "); strArray scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		} int i = 0; int i = 0; i 0 i < strArray.length i strArray.length strArray strArray.length i++ i++ i {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		} {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		} String str = strArray[i]; str strArray[i] strArray i int x x y; y switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			} str.charAt(0) str.charAt str 0 case '+': '+' case '+': y = stack.pop() y stack.pop() stack.pop stack x = stack.pop() x stack.pop() stack.pop stack stack.add(x + y) stack.add stack x + y x y break; case '-': '-' case '-': y = stack.pop() y stack.pop() stack.pop stack x = stack.pop() x stack.pop() stack.pop stack stack.add(x - y) stack.add stack x - y x y break; case '*': '*' case '*': y = stack.pop() y stack.pop() stack.pop stack x = stack.pop() x stack.pop() stack.pop stack stack.add(x * y) stack.add stack x * y x y break; default: default: stack.add(Integer.parseInt(str)) stack.add stack Integer.parseInt(str) Integer.parseInt Integer str break; System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack public class Main {

	public static void main(String args[]) {
		new Main().solve();
	}
	void solve() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		}
		System.out.println(stack.pop());
	}
} public class Main {

	public static void main(String args[]) {
		new Main().solve();
	}
	void solve() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		}
		System.out.println(stack.pop());
	}
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String args[]) {
		new Main().solve();
	}
	void solve() {
		Scanner scan = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		String[] strArray = scan.nextLine().split(" ");
		for (int i = 0; i < strArray.length; i++) {
			String str = strArray[i];
			int x,y;
			switch(str.charAt(0)) {
			case '+':
				y = stack.pop();
				x = stack.pop();
				stack.add(x + y);
				break;
			case '-':
				y = stack.pop();
				x = stack.pop();
				stack.add(x - y);
				break;
			case '*':
				y = stack.pop();
				x = stack.pop();
				stack.add(x * y);
				break;
			default:
				stack.add(Integer.parseInt(str));
				break;
			}
		}
		System.out.println(stack.pop());
	}
}

