shiki = input().split(' ')
stack = [];

for i in shiki:
    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.pop()) shiki = input().split(' ') shiki input().split(' ') ().split () input split ' ' stack = [] stack [] for i in shiki:
    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 shiki 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.pop()) print stack.pop() stack.pop stack pop stack = [] [] stack shiki = input().split(' ') input().split(' ') shiki
shiki = input().split(' ')
stack = [];

for i in shiki:
    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.pop())