import re



def revPolish(f):

    f = re.sub(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)',

        lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),

        f)

    if f[-1] in ('+','-','*','/'):

        return revPolish(f)

    else:

        return f



if __name__=='__main__':

    print((revPolish(eval(input()))))

import re

pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)')



def revPolish(f):

    global pat

    f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),f)

    if f[-1] in '+-*/':

        return revPolish(f)

    else:

        return f



print((revPolish(eval(input()))))

import re


def revPolish(f):
    f = re.sub(
        r"(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)",
        lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
        f,
    )
    if f[-1] in ("+", "-", "*", "/"):
        return revPolish(f)
    else:
        return f


if __name__ == "__main__":
    print((revPolish(eval(input()))))

import re

pat = re.compile(r"(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)")


def revPolish(f):
    global pat
    f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))), f)
    if f[-1] in "+-*/":
        return revPolish(f)
    else:
        return f


print((revPolish(eval(input()))))

+ +pat = re.compile(r"(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)") -    f = re.sub( -        r"(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)", -        lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))), -        f, -    ) -    if f[-1] in ("+", "-", "*", "/"): +    global pat +    f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))), f) +    if f[-1] in "+-*/": -if __name__ == "__main__": -    print((revPolish(eval(input())))) +print((revPolish(eval(input()))))