import java.util.Deque;
import java.util.LinkedList;

public class arithm {
    public static void main(String[] args) {
        Deque<Object> pile = new LinkedList<>();
        Object x;
        int a,b;
        for (int i = 0; i < args.length; i++) 
        {
            x = args[i];
            if (x == "+" || x == "-" || x == "/" || x == "*" ) 
            {
                switch (x) {
                    case "+":
                        a = (Integer) pile.pop();
                        b = (Integer) pile.pop();
                        pile.add(a+b);
                        break;
                    case "-":
                        a = (Integer) pile.pop();
                        b = (Integer) pile.pop();
                        pile.add(a-b);
                        break;
                    case "/":
                        a = (Integer) pile.pop();
                        b = (Integer) pile.pop();
                        pile.add(a/b);
                        break;
                    case "*":
                        a = (Integer) pile.pop();
                        b = (Integer) pile.pop();
                        pile.add(a*b);
                        break;
                }    
            }  
            else
            {
                pile.add(x);
            }  
        }
        System.out.println("="+pile.pop());
    }
}
