// Client pour Stack : calcule une expression donnée en polonaise inverse
class Compute {
    public static void main(String[] args) {
        Stack stack = new Stack();
        for (String s : args) {
            if (s.equals("+")) {
                int a = (int)stack.pop();
                int b = (int)stack.pop();
                stack.push(a+b);
            } else if (s.equals("x")) {
                // Note : si on veut indiquer la multiplication avec *, 
                // il faut l'échapper sur la ligne de commande.
                int a = (int)stack.pop();
                int b = (int)stack.pop();
                stack.push(a*b);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }
        System.out.println((int)stack.pop());
    }
}
