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(input())) import re re pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)') pat re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)') re.compile 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 revPolish global pat f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),f) f pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),f) pat.sub pat sub lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))) str(eval(m.group(1) + m.group(3) + m.group(2))) str eval(m.group(1) + m.group(3) + m.group(2)) eval m.group(1) + m.group(3) + m.group(2) m.group(1) + m.group(3) m.group(1) m.group m group 1 m.group(3) m.group m group 3 m.group(2) m.group m group 2 m f if f[-1] in '+-*/':
        return revPolish(f)
    else:
        return f f[-1] in '+-*/' f[-1] f -1 '+-*/' return revPolish(f) revPolish(f) revPolish f return f f f f print(revPolish(input())) print revPolish(input()) revPolish input() input 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 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 revPolish pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)') re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)') pat
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(input()))
