#ALDS1_3-A Elementary data structures - Stack
A=input().split()
while(len(A)>1):
    for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0]) A=input().split() A input().split() ().split () input split while(len(A)>1):
    for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break len(A)>1 len(A) len A 1 for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break i range(len(A)) range len(A) len A if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break A[i]=="+" A[i] A i "+" A[i]=int(A[i-2])+int(A[i-1]) A[i] A i 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=A[:i-2]+A[i:] A A[:i-2]+A[i:] A[:i-2] A :i-2 i-2 i 2 A[i:] A i: i break elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
         A[i]=="-" A[i] A i "-" A[i]=int(A[i-2])-int(A[i-1]) A[i] A i 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=A[:i-2]+A[i:] A A[:i-2]+A[i:] A[:i-2] A :i-2 i-2 i 2 A[i:] A i: i break elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break A[i]=="*" A[i] A i "*" A[i]=int(A[i-2])*int(A[i-1]) A[i] A i 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=A[:i-2]+A[i:] A A[:i-2]+A[i:] A[:i-2] A :i-2 i-2 i 2 A[i:] A i: i break print(A[0]) print A[0] A 0 A=input().split() input().split() A A=A[:i-2]+A[i:] A[:i-2]+A[i:] A A=A[:i-2]+A[i:] A[:i-2]+A[i:] A A=A[:i-2]+A[i:] A[:i-2]+A[i:] A
#ALDS1_3-A Elementary data structures - Stack
A=input().split()
while(len(A)>1):
    for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])