import java.util.*;

class Main
{

    //------------stack-------------
    static int[] stack = new int[100];
    static int head=0;

    static void en(int n)
    {
	stack[head]=n;
	head++;
    }

    static int de()
    {
	head--;
	int i=stack[head];
	return i;
    }

    //-----------Main---------------
    public static void main(String args[])
    {
	Scanner sc = new Scanner(System.in);
	String s;
	int x, y;
	int i, j, k;

	i=0;
	while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    }
    
    
	//print
	System.out.println(stack[0]);
	sc.close();
    
    }

} import java.util.*; util.* java class Main
{

    //------------stack-------------
    static int[] stack = new int[100];
    static int head=0;

    static void en(int n)
    {
	stack[head]=n;
	head++;
    }

    static int de()
    {
	head--;
	int i=stack[head];
	return i;
    }

    //-----------Main---------------
    public static void main(String args[])
    {
	Scanner sc = new Scanner(System.in);
	String s;
	int x, y;
	int i, j, k;

	i=0;
	while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    }
    
    
	//print
	System.out.println(stack[0]);
	sc.close();
    
    }

} Main //------------stack-------------
    static int[] stack = new int[100]; stack new int[100] 100 static int head=0; head 0 static void en(int n)
    {
	stack[head]=n;
	head++;
    } en {
	stack[head]=n;
	head++;
    } stack[head]=n stack[head] stack head n head++ head int n n static int de()
    {
	head--;
	int i=stack[head];
	return i;
    } de {
	head--;
	int i=stack[head];
	return i;
    } head-- head int i=stack[head]; i stack[head] stack head return i; i //-----------Main---------------
    public static void main(String args[])
    {
	Scanner sc = new Scanner(System.in);
	String s;
	int x, y;
	int i, j, k;

	i=0;
	while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    }
    
    
	//print
	System.out.println(stack[0]);
	sc.close();
    
    } main {
	Scanner sc = new Scanner(System.in);
	String s;
	int x, y;
	int i, j, k;

	i=0;
	while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    }
    
    
	//print
	System.out.println(stack[0]);
	sc.close();
    
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s; s int x x y; y int i i j j k; k i=0 i 0 while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    } sc.hasNext() sc.hasNext sc {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    } if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    } sc.hasNextInt()==true sc.hasNextInt() sc.hasNextInt sc true {
			en(sc.nextInt());
		    } en(sc.nextInt()) en sc.nextInt() sc.nextInt sc {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    } s=sc.next() s sc.next() sc.next sc if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    } s.equals("+")==true s.equals("+") s.equals s "+" true {
				x=de();
				y=de();
				en(y+x);
			    } x=de() x de() de y=de() y de() de en(y+x) en y+x y x if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    } s.equals("-")==true s.equals("-") s.equals s "-" true {
				x=de();
				y=de();
				en(y-x);
			    } x=de() x de() de y=de() y de() de en(y-x) en y-x y x if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    } s.equals("*")==true s.equals("*") s.equals s "*" true {				
				x=de();
				y=de();
				en(y*x);
			    } x=de() x de() de y=de() y de() de en(y*x) en y*x y x System.out.println(stack[0]) System.out.println System.out System System.out stack[0] stack 0 sc.close() sc.close sc String args[] args
import java.util.*;

class Main
{

    //------------stack-------------
    static int[] stack = new int[100];
    static int head=0;

    static void en(int n)
    {
	stack[head]=n;
	head++;
    }

    static int de()
    {
	head--;
	int i=stack[head];
	return i;
    }

    //-----------Main---------------
    public static void main(String args[])
    {
	Scanner sc = new Scanner(System.in);
	String s;
	int x, y;
	int i, j, k;

	i=0;
	while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			en(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=de();
				y=de();
				en(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=de();
				y=de();
				en(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=de();
				y=de();
				en(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    }
    
    
	//print
	System.out.println(stack[0]);
	sc.close();
    
    }

}