tmp = input().strip().split()
stack = []
for i in tmp:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(-stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print (stack[0]) tmp = input().strip().split() tmp input().strip().split() ().strip().split ().strip() ().strip () input strip split stack = [] stack [] for i in tmp:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(-stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i)) i tmp if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(-stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i)) i == '+' i '+' 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 i == '-':
        stack.append(-stack.pop() + stack.pop())
     i == '-' i '-' 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 i == '*':
        stack.append(stack.pop() * stack.pop())
     i == '*' i '*' 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(i)) stack.append stack append int(i) int i print (stack[0]) print stack[0] stack 0 tmp = input().strip().split() input().strip().split() tmp stack = [] [] stack
tmp = input().strip().split()
stack = []
for i in tmp:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(-stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print (stack[0])