# coding: utf-8

stack = []

f = input().split()

for s in f:
    if s in ('+', '-', '*'):
        stack.append(str(eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s))))
    else:
        stack.append(s)

print(*stack) stack = [] stack [] f = input().split() f input().split() ().split () input split for s in f:
    if s in ('+', '-', '*'):
        stack.append(str(eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s))))
    else:
        stack.append(s) s f if s in ('+', '-', '*'):
        stack.append(str(eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s))))
    else:
        stack.append(s) s in ('+', '-', '*') s ('+', '-', '*') '+' '-' '*' stack.append(str(eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s)))) stack.append stack append str(eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s))) str eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s)) eval "{1}{2}{0}".format(stack.pop(), stack.pop(), s) "{1}{2}{0}".format "{1}{2}{0}" format stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop s stack.append(s) stack.append stack append s print(*stack) print *stack stack stack = [] [] stack f = input().split() input().split() f
# coding: utf-8

stack = []

f = input().split()

for s in f:
    if s in ('+', '-', '*'):
        stack.append(str(eval("{1}{2}{0}".format(stack.pop(), stack.pop(), s))))
    else:
        stack.append(s)

print(*stack)