# coding:utf-8

cal = {
       "+": lambda a, b: b+a,
       "-": lambda a, b: b-a,
       "*": lambda a, b: b*a
       }

stack = []

for i in input().split():
    if i in cal:
        stack.append(cal[i](stack.pop(), stack.pop()))
    else:
        stack.append(int(i))

print(stack[-1]) cal = {
       "+": lambda a, b: b+a,
       "-": lambda a, b: b-a,
       "*": lambda a, b: b*a
       } cal {
       "+": lambda a, b: b+a,
       "-": lambda a, b: b-a,
       "*": lambda a, b: b*a
       } "+" "+" lambda a, b: b+a b+a b a a b "-" "-" lambda a, b: b-a b-a b a a b "*" "*" lambda a, b: b*a b*a b a a b stack = [] stack [] for i in input().split():
    if i in cal:
        stack.append(cal[i](stack.pop(), stack.pop()))
    else:
        stack.append(int(i)) i input().split() ().split () input split if i in cal:
        stack.append(cal[i](stack.pop(), stack.pop()))
    else:
        stack.append(int(i)) i in cal i cal stack.append(cal[i](stack.pop(), stack.pop())) stack.append stack append cal[i](stack.pop(), stack.pop()) [i] cal i 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[-1]) print stack[-1] stack -1 cal = {
       "+": lambda a, b: b+a,
       "-": lambda a, b: b-a,
       "*": lambda a, b: b*a
       } {
       "+": lambda a, b: b+a,
       "-": lambda a, b: b-a,
       "*": lambda a, b: b*a
       } cal stack = [] [] stack
# coding:utf-8

cal = {
       "+": lambda a, b: b+a,
       "-": lambda a, b: b-a,
       "*": lambda a, b: b*a
       }

stack = []

for i in input().split():
    if i in cal:
        stack.append(cal[i](stack.pop(), stack.pop()))
    else:
        stack.append(int(i))

print(stack[-1])