s = input().split()

stack = []

for a in s:
    if a == '+':
        stack.append(stack.pop() + stack.pop())
    elif a == '-':
        stack.append(-(stack.pop() - stack.pop()))
    elif a == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(a))

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

stack = []

for a in s:
    if a == '+':
        stack.append(stack.pop() + stack.pop())
    elif a == '-':
        stack.append(-(stack.pop() - stack.pop()))
    elif a == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(a))

print(stack[0])