L = input().split()
n = len(L)
A  = []
top = -1
for i in range(n):
    if L[i] not in {"+","-","*"}:
        A.append(int(L[i]))
        top += 1
    else:
        if(L[i] == "+"):
            A[top - 1] = A[top - 1] + A[top]
        elif(L[i] == "-"):
            A[top - 1] = A[top -1] - A[top]
        elif(L[i] == "*"):
            A[top - 1] = A[top - 1] * A[top]
        del A[top]
        top -= 1
print(A[top]) L = input().split() L input().split() ().split () input split n = len(L) n len(L) len L A  = [] A [] top = -1 top -1 for i in range(n):
    if L[i] not in {"+","-","*"}:
        A.append(int(L[i]))
        top += 1
    else:
        if(L[i] == "+"):
            A[top - 1] = A[top - 1] + A[top]
        elif(L[i] == "-"):
            A[top - 1] = A[top -1] - A[top]
        elif(L[i] == "*"):
            A[top - 1] = A[top - 1] * A[top]
        del A[top]
        top -= 1 i range(n) range n if L[i] not in {"+","-","*"}:
        A.append(int(L[i]))
        top += 1
    else:
        if(L[i] == "+"):
            A[top - 1] = A[top - 1] + A[top]
        elif(L[i] == "-"):
            A[top - 1] = A[top -1] - A[top]
        elif(L[i] == "*"):
            A[top - 1] = A[top - 1] * A[top]
        del A[top]
        top -= 1 L[i] not in {"+","-","*"} L[i] L i {"+","-","*"} A.append(int(L[i])) A.append A append int(L[i]) int L[i] L i top += 1 top 1 if(L[i] == "+"):
            A[top - 1] = A[top - 1] + A[top]
        elif(L[i] == "-"):
            A[top - 1] = A[top -1] - A[top]
        elif(L[i] == "*"):
            A[top - 1] = A[top - 1] * A[top]
         L[i] == "+" L[i] L i "+" A[top - 1] = A[top - 1] + A[top] A[top - 1] A top - 1 top 1 A[top - 1] + A[top] A[top - 1] A top - 1 top 1 A[top] A top elif(L[i] == "-"):
            A[top - 1] = A[top -1] - A[top]
         L[i] == "-" L[i] L i "-" A[top - 1] = A[top -1] - A[top] A[top - 1] A top - 1 top 1 A[top -1] - A[top] A[top -1] A top -1 top 1 A[top] A top elif(L[i] == "*"):
            A[top - 1] = A[top - 1] * A[top]
         L[i] == "*" L[i] L i "*" A[top - 1] = A[top - 1] * A[top] A[top - 1] A top - 1 top 1 A[top - 1] * A[top] A[top - 1] A top - 1 top 1 A[top] A top del A[top] A[top] A top top -= 1 top 1 print(A[top]) print A[top] A top A  = [] [] A n = len(L) len(L) n top += 1 1 top top -= 1 1 top L = input().split() input().split() L top = -1 -1 top
L = input().split()
n = len(L)
A  = []
top = -1
for i in range(n):
    if L[i] not in {"+","-","*"}:
        A.append(int(L[i]))
        top += 1
    else:
        if(L[i] == "+"):
            A[top - 1] = A[top - 1] + A[top]
        elif(L[i] == "-"):
            A[top - 1] = A[top -1] - A[top]
        elif(L[i] == "*"):
            A[top - 1] = A[top - 1] * A[top]
        del A[top]
        top -= 1
print(A[top])
