A = list(input().split())
B = []

for i in range(len(A)):
    if A[i]=='+':
        y=B.pop()
        x=B.pop()
        B.append(x+y)
    elif A[i]=='-':
        y=B.pop()
        x=B.pop()
        B.append(x-y)
    elif A[i]=='*':
        y=B.pop()
        x=B.pop()
        B.append(x*y)
    else:
        B.append(int(A[i]))

print(B[0]) A = list(input().split()) A list(input().split()) list input().split() ().split () input split B = [] B [] for i in range(len(A)):
    if A[i]=='+':
        y=B.pop()
        x=B.pop()
        B.append(x+y)
    elif A[i]=='-':
        y=B.pop()
        x=B.pop()
        B.append(x-y)
    elif A[i]=='*':
        y=B.pop()
        x=B.pop()
        B.append(x*y)
    else:
        B.append(int(A[i])) i range(len(A)) range len(A) len A if A[i]=='+':
        y=B.pop()
        x=B.pop()
        B.append(x+y)
    elif A[i]=='-':
        y=B.pop()
        x=B.pop()
        B.append(x-y)
    elif A[i]=='*':
        y=B.pop()
        x=B.pop()
        B.append(x*y)
    else:
        B.append(int(A[i])) A[i]=='+' A[i] A i '+' y=B.pop() y B.pop() B.pop B pop x=B.pop() x B.pop() B.pop B pop B.append(x+y) B.append B append x+y x y elif A[i]=='-':
        y=B.pop()
        x=B.pop()
        B.append(x-y)
     A[i]=='-' A[i] A i '-' y=B.pop() y B.pop() B.pop B pop x=B.pop() x B.pop() B.pop B pop B.append(x-y) B.append B append x-y x y elif A[i]=='*':
        y=B.pop()
        x=B.pop()
        B.append(x*y)
     A[i]=='*' A[i] A i '*' y=B.pop() y B.pop() B.pop B pop x=B.pop() x B.pop() B.pop B pop B.append(x*y) B.append B append x*y x y B.append(int(A[i])) B.append B append int(A[i]) int A[i] A i print(B[0]) print B[0] B 0 x=B.pop() B.pop() x A = list(input().split()) list(input().split()) A y=B.pop() B.pop() y B = [] [] B x=B.pop() B.pop() x y=B.pop() B.pop() y y=B.pop() B.pop() y x=B.pop() B.pop() x
A = list(input().split())
B = []

for i in range(len(A)):
    if A[i]=='+':
        y=B.pop()
        x=B.pop()
        B.append(x+y)
    elif A[i]=='-':
        y=B.pop()
        x=B.pop()
        B.append(x-y)
    elif A[i]=='*':
        y=B.pop()
        x=B.pop()
        B.append(x*y)
    else:
        B.append(int(A[i]))

print(B[0])
