from functools import reduce
rpn = lambda s: int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0])
print(rpn(input()))
 from functools import reduce rpn = lambda s: int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) rpn lambda s: int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) int reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0] (
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
) 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 print(rpn(input())) print rpn(input()) rpn input() input rpn = lambda s: int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) lambda s: int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0]) rpn
from functools import reduce
rpn = lambda s: int(reduce(
    lambda x, y: (
        x[:-2] + [str(eval(x[-2]+y[0]+x[-1]))] if y in '+-*'
        else x + [y]
    ), s.split(), []
)[0])
print(rpn(input()))

