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 buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.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 buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
} Main public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    } main {
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    } BufferedReader buf=new BufferedReader(new InputStreamReader(System.in)); buf new BufferedReader(new InputStreamReader(System.in)) String[] str=buf.readLine().split("\\s"); str buf.readLine().split("\\s") buf.readLine().split buf.readLine() buf.readLine buf "\\s" Stack<Integer> box = new Stack<Integer>(); box new Stack<Integer>() int tmp1=0; tmp1 0 int tmp2=0; tmp2 0 for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	} int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	} {
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	} switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            } str[i] str i case "+": "+" case "+": tmp1 = box.pop() tmp1 box.pop() box.pop box tmp2 = box.pop() tmp2 box.pop() box.pop box box.add(tmp2 + tmp1) box.add box tmp2 + tmp1 tmp2 tmp1 break; case "-": "-" case "-": tmp1 = box.pop() tmp1 box.pop() box.pop box tmp2 = box.pop() tmp2 box.pop() box.pop box box.add(tmp2 - tmp1) box.add box tmp2 - tmp1 tmp2 tmp1 break; case "*": "*" case "*": tmp1 = box.pop() tmp1 box.pop() box.pop box tmp2 = box.pop() tmp2 box.pop() box.pop box box.add(tmp2 * tmp1) box.add box tmp2 * tmp1 tmp2 tmp1 break; default: default: box.add(Integer.parseInt(str[i])) box.add box Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i System.out.println(box.pop()) System.out.println System.out System System.out box.pop() box.pop box String args[] args public class Main{
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
} public class Main{
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.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 buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
}

