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

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

stack = []
for s in input().split():
    if s in ops:
        stack.append(ops[s](stack.pop(), stack.pop()))
    else:
        stack.append(int(s))
print(stack[-1])