s=[i for i in input().split()]
k=[]

for i in range(len(s)):
    if s[i]=="+":
        b=k.pop()
        a=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i])

print(k[0]) i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i s=[i for i in input().split()] s [i for i in input().split()] k=[] k [] for i in range(len(s)):
    if s[i]=="+":
        b=k.pop()
        a=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i]) i range(len(s)) range len(s) len s if s[i]=="+":
        b=k.pop()
        a=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i]) s[i]=="+" s[i] s i "+" b=k.pop() b k.pop() k.pop k pop a=k.pop() a k.pop() k.pop k pop k.append(int(a)+int(b)) k.append k append int(a)+int(b) int(a) int a int(b) int b elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
     s[i]=="-" s[i] s i "-" b=k.pop() b k.pop() k.pop k pop a=k.pop() a k.pop() k.pop k pop k.append(int(a)-int(b)) k.append k append int(a)-int(b) int(a) int a int(b) int b elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

     s[i]=="*" s[i] s i "*" b=k.pop() b k.pop() k.pop k pop a=k.pop() a k.pop() k.pop k pop k.append(int(a)*int(b)) k.append k append int(a)*int(b) int(a) int a int(b) int b k.append(s[i]) k.append k append s[i] s i print(k[0]) print k[0] k 0 a=k.pop() k.pop() a a=k.pop() k.pop() a b=k.pop() k.pop() b b=k.pop() k.pop() b s=[i for i in input().split()] [i for i in input().split()] s a=k.pop() k.pop() a k=[] [] k b=k.pop() k.pop() b
s=[i for i in input().split()]
k=[]

for i in range(len(s)):
    if s[i]=="+":
        b=k.pop()
        a=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i])

print(k[0])
