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 Stack():
    def __init__(self):
        self.el = []
        
    def add(self, el):
        self.el.append(el)
        
    def pop(self):
        return self.el.pop()

    def isEmpty(self):
        if len(self.el) == 0:
            return True
        else:
            return False

        
a = raw_input().split()
#print a
st = Stack()

for index in range(len(a)):
    #print a[index]
    if a[index] in ['+', '-', '*']:
        num1 = st.pop()
        num2 = st.pop()
        if a[index] == '+':
            st.add(int(num1) + int(num2))
        elif a[index] == '-':
            st.add(int(num2) - int(num1))
        else:
            st.add(int(num1) * int(num2))
    else:
        st.add(a[index])
    #print st.el

ans = st.pop()
print ans