inputEnzan=input().split()

def keisan(inputEnzan):
    while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

    print(inputEnzan[0])

keisan(inputEnzan)   inputEnzan=input().split() inputEnzan input().split() ().split () input split def keisan(inputEnzan):
    while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

    print(inputEnzan[0]) keisan while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

     True stockFornumber=[] stockFornumber [] index=0 index 0 length=len(inputEnzan) length len(inputEnzan) len inputEnzan if length==1:
            break
         length==1 length 1 break while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

         index<length index length if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
             inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*" inputEnzan[index]=="+" or inputEnzan[index]=="-" inputEnzan[index]=="+" inputEnzan[index] inputEnzan index "+" inputEnzan[index]=="-" inputEnzan[index] inputEnzan index "-" inputEnzan[index]=="*" inputEnzan[index] inputEnzan index "*" if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

             len(stockFornumber)==2 len(stockFornumber) len stockFornumber 2 if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                 inputEnzan[index]=="+" inputEnzan[index] inputEnzan index "+" inputEnzan[index]=stockFornumber[0]+stockFornumber[1] inputEnzan[index] inputEnzan index stockFornumber[0]+stockFornumber[1] stockFornumber[0] stockFornumber 0 stockFornumber[1] stockFornumber 1 stockFornumber=[] stockFornumber [] inputEnzan[index-1]="null" inputEnzan[index-1] inputEnzan index-1 index 1 "null" inputEnzan[index-2]="null" inputEnzan[index-2] inputEnzan index-2 index 2 "null" elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                     inputEnzan[index]=="-" inputEnzan[index] inputEnzan index "-" inputEnzan[index]=stockFornumber[0]-stockFornumber[1] inputEnzan[index] inputEnzan index stockFornumber[0]-stockFornumber[1] stockFornumber[0] stockFornumber 0 stockFornumber[1] stockFornumber 1 stockFornumber=[] stockFornumber [] inputEnzan[index-1]="null" inputEnzan[index-1] inputEnzan index-1 index 1 "null" inputEnzan[index-2]="null" inputEnzan[index-2] inputEnzan index-2 index 2 "null" inputEnzan[index]=stockFornumber[0]*stockFornumber[1] inputEnzan[index] inputEnzan index stockFornumber[0]*stockFornumber[1] stockFornumber[0] stockFornumber 0 stockFornumber[1] stockFornumber 1 stockFornumber=[] stockFornumber [] inputEnzan[index-1]="null" inputEnzan[index-1] inputEnzan index-1 index 1 "null" inputEnzan[index-2]="null" inputEnzan[index-2] inputEnzan index-2 index 2 "null" stockFornumber=[] stockFornumber [] if len(stockFornumber)==2:
                    del stockFornumber[0]
                 len(stockFornumber)==2 len(stockFornumber) len stockFornumber 2 del stockFornumber[0] stockFornumber[0] stockFornumber 0 stockFornumber.append(int(inputEnzan[index])) stockFornumber.append stockFornumber append int(inputEnzan[index]) int inputEnzan[index] inputEnzan index index+=1 index 1 while "null" in inputEnzan:
            inputEnzan.remove("null")

     "null" in inputEnzan "null" inputEnzan inputEnzan.remove("null") inputEnzan.remove inputEnzan remove "null" print(inputEnzan[0]) print inputEnzan[0] inputEnzan 0 inputEnzan inputEnzan keisan(inputEnzan) keisan inputEnzan inputEnzan=input().split() input().split() inputEnzan def keisan(inputEnzan):
    while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

    print(inputEnzan[0]) def keisan(inputEnzan):
    while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

    print(inputEnzan[0]) keisan
inputEnzan=input().split()

def keisan(inputEnzan):
    while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

    print(inputEnzan[0])

keisan(inputEnzan)  
