s=input().split()
a=[]
for i in s:
    if i in ["+","-","*"]:
        a1=str(a.pop())
        a2=str(a.pop())
        t = eval(a2+i+a1)
        a.append(t)
    else:
        a.append(int(i))
print(a.pop()) s=input().split() s input().split() ().split () input split a=[] a [] for i in s:
    if i in ["+","-","*"]:
        a1=str(a.pop())
        a2=str(a.pop())
        t = eval(a2+i+a1)
        a.append(t)
    else:
        a.append(int(i)) i s if i in ["+","-","*"]:
        a1=str(a.pop())
        a2=str(a.pop())
        t = eval(a2+i+a1)
        a.append(t)
    else:
        a.append(int(i)) i in ["+","-","*"] i ["+","-","*"] "+" "-" "*" a1=str(a.pop()) a1 str(a.pop()) str a.pop() a.pop a pop a2=str(a.pop()) a2 str(a.pop()) str a.pop() a.pop a pop t = eval(a2+i+a1) t eval(a2+i+a1) eval a2+i+a1 a2+i a2 i a1 a.append(t) a.append a append t a.append(int(i)) a.append a append int(i) int i print(a.pop()) print a.pop() a.pop a pop a=[] [] a t = eval(a2+i+a1) eval(a2+i+a1) t s=input().split() input().split() s a1=str(a.pop()) str(a.pop()) a1 a2=str(a.pop()) str(a.pop()) a2
s=input().split()
a=[]
for i in s:
    if i in ["+","-","*"]:
        a1=str(a.pop())
        a2=str(a.pop())
        t = eval(a2+i+a1)
        a.append(t)
    else:
        a.append(int(i))
print(a.pop())