import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    } main {
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int[] stack = new int[100]; stack new int[100] 100 int now = 0; now 0 while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	} scan.hasNext() scan.hasNext scan {
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	} String line = scan.next(); line scan.next() scan.next scan switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		} line case "+": "+" case "+": stack[now - 2] += stack[now - 1] stack[now - 2] stack now - 2 now 2 stack[now - 1] stack now - 1 now 1 now-- now break; case "-": "-" case "-": stack[now - 2] -= stack[now - 1] stack[now - 2] stack now - 2 now 2 stack[now - 1] stack now - 1 now 1 now-- now break; case "*": "*" case "*": stack[now - 2] *= stack[now - 1] stack[now - 2] stack now - 2 now 2 stack[now - 1] stack now - 1 now 1 now-- now break; default: default: stack[now] = Integer.parseInt(line) stack[now] stack now Integer.parseInt(line) Integer.parseInt Integer line now++ now System.out.println(stack[0]) System.out.println System.out System System.out stack[0] stack 0 String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    	int[] stack = new int[100];
    	int now = 0;
    	while(scan.hasNext()){
    		String line = scan.next();
    		switch(line){
    			case "+":
    				stack[now - 2] += stack[now - 1];
    				now--;
    				break;
    			case "-":
    				stack[now - 2] -= stack[now - 1];
    				now--;
    				break;
    			case "*":
    				stack[now - 2] *= stack[now - 1];
    				now--;
    				break;
    			default:
	    			stack[now] = Integer.parseInt(line);
    				now++;
    		}
    	}
    	System.out.println(stack[0]);
    }
}
