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