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

public class Main {

	public static void main(String[] args) {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     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) {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     System.out.println(stack.pop());
	}

} Main public static void main(String[] args) {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     System.out.println(stack.pop());
	} main {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     System.out.println(stack.pop());
	} String[] chars = new Scanner(System.in).nextLine().split(" "); chars new Scanner(System.in).nextLine().split(" ") new Scanner(System.in).nextLine().split new Scanner(System.in).nextLine() new Scanner(System.in).nextLine new Scanner(System.in) " " Stack<String> stack = new Stack<String>(); stack new Stack<String>() for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     } String s chars {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     } {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     } if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 } s.equals("+") s.equals s "+" {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 } int b = Integer.valueOf(stack.pop()) b Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack a = Integer.valueOf(stack.pop()); a Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack stack.push(Integer.toString(a+b)) stack.push stack Integer.toString(a+b) Integer.toString Integer a+b a b if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 } s.equals("-") s.equals s "-" {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 } int b = Integer.valueOf(stack.pop()) b Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack a = Integer.valueOf(stack.pop()); a Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack stack.push(Integer.toString(a-b)) stack.push stack Integer.toString(a-b) Integer.toString Integer a-b a b if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 } s.equals("*") s.equals s "*" {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 } int b = Integer.valueOf(stack.pop()) b Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack a = Integer.valueOf(stack.pop()); a Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack stack.push(Integer.toString(a*b)) stack.push stack Integer.toString(a*b) Integer.toString Integer a*b a b {
	    		 stack.push(s);
	    	 } stack.push(s) stack.push stack s 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) {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     System.out.println(stack.pop());
	}

} public class Main {

	public static void main(String[] args) {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     System.out.println(stack.pop());
	}

} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
	     String[] chars = new Scanner(System.in).nextLine().split(" ");
	     Stack<String> stack = new Stack<String>();
	     for(String s: chars) {
	    	 if(s.equals("+")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a+b));
	    	 }
	    	 else if(s.equals("-")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a-b));
	    	 }
	    	 else if(s.equals("*")) {
	    		 int b = Integer.valueOf(stack.pop()), a = Integer.valueOf(stack.pop());
	    		 stack.push(Integer.toString(a*b));
	    	 }
	    	 else {
	    		 stack.push(s);
	    	 }
	     }
	     System.out.println(stack.pop());
	}

}

