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