symbol = list(input().split())
stack = []

while len(symbol) > 0:
    x = symbol.pop(0)
    if x.isdigit():
        stack.append(int(x))
    else:
        a,b = stack.pop(),stack.pop()
        if x == "+":
            stack.append(b + a)
        elif x == "-":
            stack.append(b - a)
        elif x == "*":
            stack.append(b * a)

print(stack.pop())
 symbol = list(input().split()) symbol list(input().split()) list input().split() ().split () input split stack = [] stack [] while len(symbol) > 0:
    x = symbol.pop(0)
    if x.isdigit():
        stack.append(int(x))
    else:
        a,b = stack.pop(),stack.pop()
        if x == "+":
            stack.append(b + a)
        elif x == "-":
            stack.append(b - a)
        elif x == "*":
            stack.append(b * a) len(symbol) > 0 len(symbol) len symbol 0 x = symbol.pop(0) x symbol.pop(0) symbol.pop symbol pop 0 if x.isdigit():
        stack.append(int(x))
    else:
        a,b = stack.pop(),stack.pop()
        if x == "+":
            stack.append(b + a)
        elif x == "-":
            stack.append(b - a)
        elif x == "*":
            stack.append(b * a) x.isdigit() x.isdigit x isdigit stack.append(int(x)) stack.append stack append int(x) int x a,b = stack.pop(),stack.pop() a stack.pop() stack.pop stack pop b stack.pop() stack.pop stack pop if x == "+":
            stack.append(b + a)
        elif x == "-":
            stack.append(b - a)
        elif x == "*":
            stack.append(b * a) x == "+" x "+" stack.append(b + a) stack.append stack append b + a b a elif x == "-":
            stack.append(b - a)
         x == "-" x "-" stack.append(b - a) stack.append stack append b - a b a elif x == "*":
            stack.append(b * a) x == "*" x "*" stack.append(b * a) stack.append stack append b * a b a print(stack.pop()) print stack.pop() stack.pop stack pop b = stack.pop(),stack.pop() stack.pop() b stack = [] [] stack a,b = stack.pop(),stack.pop() stack.pop() a symbol = list(input().split()) list(input().split()) symbol x = symbol.pop(0) symbol.pop(0) x
symbol = list(input().split())
stack = []

while len(symbol) > 0:
    x = symbol.pop(0)
    if x.isdigit():
        stack.append(int(x))
    else:
        a,b = stack.pop(),stack.pop()
        if x == "+":
            stack.append(b + a)
        elif x == "-":
            stack.append(b - a)
        elif x == "*":
            stack.append(b * a)

print(stack.pop())

