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