stack = []

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

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