Notes

Template in C

Constraints

2 ≤ the number of operands in the expression ≤ 100
1 ≤ the number of operators in the expression ≤ 99
-1 × 109 ≤ values in the stack ≤ 109

Input

An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character.

You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106

Output

Print the computational result in a line.

Examples

Input

1 2 +


Output

3


Input

1 2 + 3 4 - *


Output

-3
class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value

sequence = raw_input().split()
operators = {"*": "*", "+": "+", "-": "-"}
stack = MyStack()
for s in sequence:
    if s in operators:
        value2 = stack.pop()
        value1 = stack.pop()
        stack.push(str(eval(value1 + operators[s] + value2)))
    else:
        stack.push(s)

print(stack.pop())