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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	}
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	} main {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		} ; sc.hasNext() sc.hasNext sc {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		} {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		} if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			} sc.hasNextInt() sc.hasNextInt sc {
				stack.push(sc.nextInt());
			} stack.push(sc.nextInt()) stack.push stack sc.nextInt() sc.nextInt sc {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			} char op = sc.next().charAt(0); op sc.next().charAt(0) sc.next().charAt sc.next() sc.next sc 0 int b = stack.pop(); b stack.pop() stack.pop stack int a = stack.pop(); a stack.pop() stack.pop stack int result; result switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				} op case '+': '+' case '+': result = a + b result a + b a b break; case '-': '-' case '-': result = a - b result a - b a b break; case '*': '*' case '*': result = a * b result a * b a b break; default: default: result = -1 result -1 1 stack.push(result) stack.push stack result System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	}
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Stack<Integer> stack = new Stack<Integer>();
		
		for (; sc.hasNext(); ) {
			if (sc.hasNextInt()) {
				stack.push(sc.nextInt());
			} else {
				char op = sc.next().charAt(0);
				int b = stack.pop();
				int a = stack.pop();
				int result;
				switch (op) {
				case '+':
					result = a + b;
					break;
				case '-':
					result = a - b;
					break;
				case '*':
					result = a * b;
					break;
				default:
					result = -1;
				}
				stack.push(result);
			}
		}
		
    	System.out.println(stack.pop());
    	
        sc.close();
	}
}