vs = input().split()

stack = []
for v in vs:
    if v == '+':
        stack.append(stack.pop() + stack.pop())
    elif v == '-':
        stack.append(-stack.pop() + stack.pop())
    elif v == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(v))

print(stack.pop())
 vs = input().split() vs input().split() ().split () input split stack = [] stack [] for v in vs:
    if v == '+':
        stack.append(stack.pop() + stack.pop())
    elif v == '-':
        stack.append(-stack.pop() + stack.pop())
    elif v == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(v)) v vs if v == '+':
        stack.append(stack.pop() + stack.pop())
    elif v == '-':
        stack.append(-stack.pop() + stack.pop())
    elif v == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(v)) v == '+' v '+' stack.append(stack.pop() + stack.pop()) stack.append stack append stack.pop() + stack.pop() stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop elif v == '-':
        stack.append(-stack.pop() + stack.pop())
     v == '-' v '-' stack.append(-stack.pop() + stack.pop()) stack.append stack append -stack.pop() + stack.pop() -stack.pop() stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop elif v == '*':
        stack.append(stack.pop() * stack.pop())
     v == '*' v '*' stack.append(stack.pop() * stack.pop()) stack.append stack append stack.pop() * stack.pop() stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop stack.append(int(v)) stack.append stack append int(v) int v print(stack.pop()) print stack.pop() stack.pop stack pop vs = input().split() input().split() vs stack = [] [] stack
vs = input().split()

stack = []
for v in vs:
    if v == '+':
        stack.append(stack.pop() + stack.pop())
    elif v == '-':
        stack.append(-stack.pop() + stack.pop())
    elif v == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(v))

print(stack.pop())

