import java.util.*;

class Main
{

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

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

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

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

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

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

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

	i=0;
	while(sc.hasNext())
	    {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			stack.push(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    }
    
    
	//print
	System.out.println(stack.stack[0]);
	sc.close();
    
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main.Stack stack = new Main.Stack(); stack new Main.Stack() 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)
		    {
			stack.push(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    } sc.hasNext() sc.hasNext sc {
		//Read number
		if(sc.hasNextInt()==true)
		    {
			stack.push(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    }
	    } if(sc.hasNextInt()==true)
		    {
			stack.push(sc.nextInt());
		    }
		//Read operand
		else
		    {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    } sc.hasNextInt()==true sc.hasNextInt() sc.hasNextInt sc true {
			stack.push(sc.nextInt());
		    } stack.push(sc.nextInt()) stack.push stack sc.nextInt() sc.nextInt sc {
			s=sc.next();
			//+
			if(s.equals("+")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    }
			//else if(s.equals(null)==true)break;
		    } s=sc.next() s sc.next() sc.next sc if(s.equals("+")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    }
		
			//-
			else if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    } s.equals("+")==true s.equals("+") s.equals s "+" true {
				x=stack.pop();
				y=stack.pop();
				stack.push(y+x);
			    } x=stack.pop() x stack.pop() stack.pop stack y=stack.pop() y stack.pop() stack.pop stack stack.push(y+x) stack.push stack y+x y x if(s.equals("-")==true)
			    {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    }
			//*
			else if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    } s.equals("-")==true s.equals("-") s.equals s "-" true {
				x=stack.pop();
				y=stack.pop();
				stack.push(y-x);
			    } x=stack.pop() x stack.pop() stack.pop stack y=stack.pop() y stack.pop() stack.pop stack stack.push(y-x) stack.push stack y-x y x if(s.equals("*")==true)
			    {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    } s.equals("*")==true s.equals("*") s.equals s "*" true {				
				x=stack.pop();
				y=stack.pop();
				stack.push(y*x);
			    } x=stack.pop() x stack.pop() stack.pop stack y=stack.pop() y stack.pop() stack.pop stack stack.push(y*x) stack.push stack y*x y x System.out.println(stack.stack[0]) System.out.println System.out System System.out stack.stack[0] stack.stack stack stack.stack 0 sc.close() sc.close sc String args[] args static class Stack
    {
	int[] stack = new int[100];
	int head=0;
	
	void push(int n)
	{
	    stack[head]=n;
	    head++;
	}
	
	int pop()
	{
	    head--;
	    int i=stack[head];
	    return i;
	}
    } Stack int[] stack = new int[100]; stack new int[100] 100 int head=0; head 0 void push(int n)
	{
	    stack[head]=n;
	    head++;
	} push {
	    stack[head]=n;
	    head++;
	} stack[head]=n stack[head] stack head n head++ head int n n int pop()
	{
	    head--;
	    int i=stack[head];
	    return i;
	} pop {
	    head--;
	    int i=stack[head];
	    return i;
	} head-- head int i=stack[head]; i stack[head] stack head return i; i
import java.util.*;

class Main
{

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

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

}