import java.util.Scanner;
public class Main{
    static int stack[]=new int[101];
	public static void main(String[] args) {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	}
	public static boolean Number(String a){
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
}
} import java.util.Scanner; Scanner java.util public class Main{
    static int stack[]=new int[101];
	public static void main(String[] args) {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	}
	public static boolean Number(String a){
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
}
} Main static int stack[]=new int[101]; stack new int[101] 101 public static void main(String[] args) {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	} main {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	} int i=0; i 0 String s; s Scanner sc= new Scanner(System.in); sc new Scanner(System.in) s=sc.next() s sc.next() sc.next sc while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    } true {
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    } if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     } Number(s) Number s {
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 } i++ i stack[i]=Integer.parseInt(s) stack[i] stack i Integer.parseInt(s) Integer.parseInt Integer s {
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     } if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 } s.equals("+") s.equals s "+" {
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 } stack[i-1]=stack[i-1]+stack[i] stack[i-1] stack i-1 i 1 stack[i-1]+stack[i] stack[i-1] stack i-1 i 1 stack[i] stack i i-- i if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		} s.equals("-") s.equals s "-" {
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		} stack[i-1]=stack[i-1]-stack[i] stack[i-1] stack i-1 i 1 stack[i-1]-stack[i] stack[i-1] stack i-1 i 1 stack[i] stack i i-- i if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		} s.equals("*") s.equals s "*" {
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		} stack[i-1]=stack[i-1]*stack[i] stack[i-1] stack i-1 i 1 stack[i-1]*stack[i] stack[i-1] stack i-1 i 1 stack[i] stack i i-- i if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		} s.equals("/") s.equals s "/" {
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		} stack[i-1]=stack[i-1]/stack[i] stack[i-1] stack i-1 i 1 stack[i-1]/stack[i] stack[i-1] stack i-1 i 1 stack[i] stack i i-- i if(!sc.hasNext()) break; !sc.hasNext() sc.hasNext() sc.hasNext sc break; s=sc.next() s sc.next() sc.next sc System.out.println(stack[1]) System.out.println System.out System System.out stack[1] stack 1 String[] args args public static boolean Number(String a){
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
} Number {
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
} try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	} catch(Exception e){
		return false;
	} Exception e {
		return false;
	} return false; false {
			Integer.parseInt(a);
		return true ;
		} Integer.parseInt(a) Integer.parseInt Integer a return true ; true String a a public class Main{
    static int stack[]=new int[101];
	public static void main(String[] args) {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	}
	public static boolean Number(String a){
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
}
} public class Main{
    static int stack[]=new int[101];
	public static void main(String[] args) {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	}
	public static boolean Number(String a){
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
}
} Main
import java.util.Scanner;
public class Main{
    static int stack[]=new int[101];
	public static void main(String[] args) {
		int i=0;
		String s;
		// TODO Auto-generated method stub
    Scanner sc= new Scanner(System.in);
	s=sc.next();
    while(true){
    	if(Number(s)){
    	 i++;
    	 stack[i]=Integer.parseInt(s);
    	 }else{
    		 if(s.equals("+")){
    			 stack[i-1]=stack[i-1]+stack[i];
    			 i--;
    		 }
    		if(s.equals("-")){
    			stack[i-1]=stack[i-1]-stack[i];
    			i--;
    		}
    		if(s.equals("*")){
    			stack[i-1]=stack[i-1]*stack[i];
    			i--;
    		}
    		if(s.equals("/")){
    			stack[i-1]=stack[i-1]/stack[i];
    			i--;
    		}
    	 
     }
    	if(!sc.hasNext()) break;
    	s=sc.next();
    }
    System.out.println(stack[1]);
	}
	public static boolean Number(String a){
		try{
			Integer.parseInt(a);
		return true ;
		}catch(Exception e){
		return false;
	}
}
}
