
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    }
	 
	} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Stack; Stack java.util public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    }
	 
	} Main public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    } main {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    } BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); bufferedReader new BufferedReader(new InputStreamReader(System.in)) String[] strArray = bufferedReader.readLine().split(" "); strArray bufferedReader.readLine().split(" ") bufferedReader.readLine().split bufferedReader.readLine() bufferedReader.readLine bufferedReader " " Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        } int i = 0; int i = 0; i 0 i < strArray.length i strArray.length strArray strArray.length i++ i++ i {
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        } {
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        } char input = strArray[i].charAt(0); input strArray[i].charAt(0) strArray[i].charAt strArray[i] strArray i 0 if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            } Character.isDigit(input) Character.isDigit Character input {
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            } stack.push(Integer.parseInt(strArray[i])) stack.push stack Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            } int tmp = 0; tmp 0 switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					} input case '+': '+' case '+': tmp = stack.pop() + stack.pop() tmp stack.pop() + stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack break; case '-': '-' case '-': tmp = - (stack.pop() - stack.pop()) tmp - (stack.pop() - stack.pop()) (stack.pop() - stack.pop()) stack.pop() stack.pop stack stack.pop() stack.pop stack break; case '*': '*' case '*': tmp = stack.pop() * stack.pop() tmp stack.pop() * stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack break; default: default: break; stack.push(tmp) stack.push stack tmp 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) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    }
	 
	} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    }
	 
	} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	        String[] strArray = bufferedReader.readLine().split(" ");
	        Stack<Integer> stack = new Stack<Integer>();
	         
	        for(int i = 0; i < strArray.length ; i++){
	            char input = strArray[i].charAt(0);
	            if(Character.isDigit(input)){
	            	// ??°????????´?????????push???????????????
	                stack.push(Integer.parseInt(strArray[i]));
	            }
	            else {
	                int tmp = 0; 
	                switch (input) {
					case '+':
						tmp = stack.pop() + stack.pop();
						break;
					case '-':
						tmp = - (stack.pop() - stack.pop());
						break;
					case '*':
						tmp = stack.pop() * stack.pop();
						break;
					default:
						break;
					}
	                // ????????§?¨??????????????????????push???????????????
	                stack.push(tmp);
	            }
	        }
	         
	        System.out.println(stack.pop());
	    }
	 
	}