import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    } main {
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) ArrayList<Integer> operand=new ArrayList<Integer>(); operand new ArrayList<Integer>() String command=scan.nextLine(); command scan.nextLine() scan.nextLine scan String[] com1=command.split(" ",0); com1 command.split(" ",0) command.split command " " 0 int osize osize comsize=1; comsize 1 for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        } int i=0; int i=0; i 0 command.indexOf(" ",i)!=-1 command.indexOf(" ",i) command.indexOf command " " i -1 1 i=command.indexOf(" ",i)+1 i=command.indexOf(" ",i)+1 i command.indexOf(" ",i)+1 command.indexOf(" ",i) command.indexOf command " " i 1 {
            comsize++;
        } {
            comsize++;
        } comsize++ comsize for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        } int i=0; int i=0; i 0 i<comsize i comsize i++ i++ i {
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        } {
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        } osize=operand.size() osize operand.size() operand.size operand if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            } com1[i].charAt(0)<'0' com1[i].charAt(0) com1[i].charAt com1[i] com1 i 0 '0' {
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            } switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                } com1[i].charAt(0) com1[i].charAt com1[i] com1 i 0 case '+': '+' case '+': operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1)) operand.set operand osize-2 osize 2 operand.get(osize-2)+operand.remove(osize-1) operand.get(osize-2) operand.get operand osize-2 osize 2 operand.remove(osize-1) operand.remove operand osize-1 osize 1 break; case '-': '-' case '-': operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1)) operand.set operand osize-2 osize 2 operand.get(osize-2)-operand.remove(osize-1) operand.get(osize-2) operand.get operand osize-2 osize 2 operand.remove(osize-1) operand.remove operand osize-1 osize 1 break; case '*': '*' case '*': operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1)) operand.set operand osize-2 osize 2 operand.get(osize-2)*operand.remove(osize-1) operand.get(osize-2) operand.get operand osize-2 osize 2 operand.remove(osize-1) operand.remove operand osize-1 osize 1 break; {
                operand.add(Integer.parseInt(com1[i]));
            } operand.add(Integer.parseInt(com1[i])) operand.add operand Integer.parseInt(com1[i]) Integer.parseInt Integer com1[i] com1 i System.out.println(operand.get(0)) System.out.println System.out System System.out operand.get(0) operand.get operand 0 String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        ArrayList<Integer> operand=new ArrayList<Integer>();
        String command=scan.nextLine();
        String[] com1=command.split(" ",0);
        int osize, comsize=1;
        
        for(int i=0; command.indexOf(" ",i)!=-1; i=command.indexOf(" ",i)+1){
            comsize++;
        }
        //System.out.println(comsize+":"+Arrays.toString(com1));
        
        for(int i=0; i<comsize; i++){
            osize=operand.size();
            //System.out.println(com1[i]);
            if(com1[i].charAt(0)<'0'){
                switch(com1[i].charAt(0)){
                    case '+':
                        operand.set(osize-2,operand.get(osize-2)+operand.remove(osize-1));
                    break;
                    case '-':
                        operand.set(osize-2,operand.get(osize-2)-operand.remove(osize-1));
                    break;
                    case '*':
                        operand.set(osize-2,operand.get(osize-2)*operand.remove(osize-1));
                    break;
                }
            }else{
                operand.add(Integer.parseInt(com1[i]));
            }
            //System.out.println(operand.size()+":"+operand);
        }
        System.out.println(operand.get(0));
    }
}
