import java.util.*;

public class Main{
	
	public static void main(String[] args) {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	}
		
} import java.util.*; util.* java public class Main{
	
	public static void main(String[] args) {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	}
		
} Main public static void main(String[] args) {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	} main {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	} int val; val int val2; val2 int result; result Scanner in = new Scanner(System.in); in new Scanner(System.in) Stack<Integer> stack = new Stack<>(); stack new Stack<>() String expression = in.nextLine(); expression in.nextLine() in.nextLine in String[] arr = expression.split(" "); arr expression.split(" ") expression.split expression " " for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		} String str arr {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		} {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		} switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			} str case "+" : "+" case "+" : val = stack.pop() val stack.pop() stack.pop stack val2 = stack.pop() val2 stack.pop() stack.pop stack stack.push(val + val2) stack.push stack val + val2 val val2 break; case "-": "-" case "-": val = stack.pop() val stack.pop() stack.pop stack val2 = stack.pop() val2 stack.pop() stack.pop stack stack.push(val2 - val) stack.push stack val2 - val val2 val break; case "*": "*" case "*": val = stack.pop() val stack.pop() stack.pop stack val2 = stack.pop() val2 stack.pop() stack.pop stack stack.push(val * val2) stack.push stack val * val2 val val2 break; case "/": "/" case "/": val = stack.pop() val stack.pop() stack.pop stack val2 = stack.pop() val2 stack.pop() stack.pop stack stack.push(val2 / val) stack.push stack val2 / val val2 val break; default: default: stack.push(Integer.parseInt(str)) stack.push stack Integer.parseInt(str) Integer.parseInt Integer str break; result = stack.pop() result stack.pop() stack.pop stack System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main{
	
	public static void main(String[] args) {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	}
		
} public class Main{
	
	public static void main(String[] args) {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	}
		
} Main
import java.util.*;

public class Main{
	
	public static void main(String[] args) {
		int val;
		int val2;
		int result;
		Scanner in = new Scanner(System.in);
		Stack<Integer> stack = new Stack<>();
		String expression = in.nextLine();
		String[] arr = expression.split(" ");

		for(String str : arr) {
			
			
			switch(str) {
			case "+" :
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val + val2);
				break;
			case "-":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 - val);
				break;
			case "*":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val * val2);	
				break;
			case "/":
				val = stack.pop();
				val2 = stack.pop();
				stack.push(val2 / val);
				break;
			default:
				stack.push(Integer.parseInt(str));
				break;
			
			}
			
			
		}
		
		result = stack.pop();
		System.out.println(result);
			
	}
		
}
