print((lambda s: int(__import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]))(input()))
 print((lambda s: int(__import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]))(input())) print (lambda s: int(__import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]))(input()) lambda s: int(__import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) int(__import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) int __import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0] ('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
) ('functools').reduce ('functools') __import__ 'functools' reduce lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ) x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y] y in '+-*' y '+-*' x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] x[:-2] x :-2 -2 [str(eval(x[-2]+y[0]+x[-1]))] str(eval(x[-2]+y[0]+x[-1])) str eval(x[-2]+y[0]+x[-1]) eval x[-2]+y[0]+x[-1] x[-2]+y[0] x[-2] x -2 y[0] y 0 x[-1] x -1 x + [y] x [y] y x y s.split() s.split s split [] 0 s input() input
print((lambda s: int(__import__('functools').reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]))(input()))

