import re

stack = []
_l = input().split(' ')

for c in _l:
    if re.match(r"(\+|\-|\/|\*)", c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))
    else:
        stack += [c]

print(stack[0]) import re re stack = [] stack [] _l = input().split(' ') _l input().split(' ') ().split () input split ' ' for c in _l:
    if re.match(r"(\+|\-|\/|\*)", c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))
    else:
        stack += [c] c _l if re.match(r"(\+|\-|\/|\*)", c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))
    else:
        stack += [c] re.match(r"(\+|\-|\/|\*)", c) re.match re match r"(\+|\-|\/|\*)" c f = stack.pop() f stack.pop() stack.pop stack pop z = stack.pop() z stack.pop() stack.pop stack pop stack.append(eval("{}{}{}".format(z, c, f))) stack.append stack append eval("{}{}{}".format(z, c, f)) eval "{}{}{}".format(z, c, f) "{}{}{}".format "{}{}{}" format z c f stack += [c] stack [c] c print(stack[0]) print stack[0] stack 0 stack = [] [] stack f = stack.pop() stack.pop() f z = stack.pop() stack.pop() z stack += [c] [c] stack _l = input().split(' ') input().split(' ') _l
import re

stack = []
_l = input().split(' ')

for c in _l:
    if re.match(r"(\+|\-|\/|\*)", c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))
    else:
        stack += [c]

print(stack[0])