
A=input().split()
i=0
for j in range(len(A)):
    if A[i]=="+":
        r=int(A[i-2])+int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    if A[i]=="-":
        r=int(A[i-2])-int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    if A[i]=="*":
        r=int(A[i-2])*int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    i+=1

print(r)
 A=input().split() A input().split() ().split () input split i=0 i 0 for j in range(len(A)):
    if A[i]=="+":
        r=int(A[i-2])+int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    if A[i]=="-":
        r=int(A[i-2])-int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    if A[i]=="*":
        r=int(A[i-2])*int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    i+=1 j range(len(A)) range len(A) len A if A[i]=="+":
        r=int(A[i-2])+int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
     A[i]=="+" A[i] A i "+" r=int(A[i-2])+int(A[i-1]) r int(A[i-2])+int(A[i-1]) int(A[i-2]) int A[i-2] A i-2 i 2 int(A[i-1]) int A[i-1] A i-1 i 1 A[i]=r A[i] A i r del(A[i-2]) A[i-2] A i-2 i 2 del(A[i-2]) A[i-2] A i-2 i 2 i-=2 i 2 if A[i]=="-":
        r=int(A[i-2])-int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
     A[i]=="-" A[i] A i "-" r=int(A[i-2])-int(A[i-1]) r int(A[i-2])-int(A[i-1]) int(A[i-2]) int A[i-2] A i-2 i 2 int(A[i-1]) int A[i-1] A i-1 i 1 A[i]=r A[i] A i r del(A[i-2]) A[i-2] A i-2 i 2 del(A[i-2]) A[i-2] A i-2 i 2 i-=2 i 2 if A[i]=="*":
        r=int(A[i-2])*int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
     A[i]=="*" A[i] A i "*" r=int(A[i-2])*int(A[i-1]) r int(A[i-2])*int(A[i-1]) int(A[i-2]) int A[i-2] A i-2 i 2 int(A[i-1]) int A[i-1] A i-1 i 1 A[i]=r A[i] A i r del(A[i-2]) A[i-2] A i-2 i 2 del(A[i-2]) A[i-2] A i-2 i 2 i-=2 i 2 i+=1 i 1 print(r) print r i-=2 2 i i+=1 1 i r=int(A[i-2])+int(A[i-1]) int(A[i-2])+int(A[i-1]) r i-=2 2 i i-=2 2 i r=int(A[i-2])*int(A[i-1]) int(A[i-2])*int(A[i-1]) r i=0 0 i r=int(A[i-2])-int(A[i-1]) int(A[i-2])-int(A[i-1]) r A=input().split() input().split() A

A=input().split()
i=0
for j in range(len(A)):
    if A[i]=="+":
        r=int(A[i-2])+int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    if A[i]=="-":
        r=int(A[i-2])-int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    if A[i]=="*":
        r=int(A[i-2])*int(A[i-1])
        A[i]=r
        del(A[i-2])
        del(A[i-2])
        i-=2
    i+=1

print(r)

