stak = []
for i in input().split():
    if i in "+-*":
        x = stak.pop()
        y = stak.pop()
        stak.append(str(eval(y + i + x)))
    else:
        stak.append(i)
print(stak.pop()) stak = [] stak [] for i in input().split():
    if i in "+-*":
        x = stak.pop()
        y = stak.pop()
        stak.append(str(eval(y + i + x)))
    else:
        stak.append(i) i input().split() ().split () input split if i in "+-*":
        x = stak.pop()
        y = stak.pop()
        stak.append(str(eval(y + i + x)))
    else:
        stak.append(i) i in "+-*" i "+-*" x = stak.pop() x stak.pop() stak.pop stak pop y = stak.pop() y stak.pop() stak.pop stak pop stak.append(str(eval(y + i + x))) stak.append stak append str(eval(y + i + x)) str eval(y + i + x) eval y + i + x y + i y i x stak.append(i) stak.append stak append i print(stak.pop()) print stak.pop() stak.pop stak pop y = stak.pop() stak.pop() y stak = [] [] stak x = stak.pop() stak.pop() x
stak = []
for i in input().split():
    if i in "+-*":
        x = stak.pop()
        y = stak.pop()
        stak.append(str(eval(y + i + x)))
    else:
        stak.append(i)
print(stak.pop())
