a = input().split()

stack = []
for inp in a:
    if inp == "+":
        x = stack.pop()
        y = stack.pop()
        stack.append(x+y)
    elif inp == "-":
        x = stack.pop()
        y = stack.pop()
        stack.append(y-x)
    elif inp == "*":
        x = stack.pop()
        y = stack.pop()
        stack.append(x*y)
    else:
        stack.append(int(inp))

print(*stack) a = input().split() a input().split() ().split () input split stack = [] stack [] for inp in a:
    if inp == "+":
        x = stack.pop()
        y = stack.pop()
        stack.append(x+y)
    elif inp == "-":
        x = stack.pop()
        y = stack.pop()
        stack.append(y-x)
    elif inp == "*":
        x = stack.pop()
        y = stack.pop()
        stack.append(x*y)
    else:
        stack.append(int(inp)) inp a if inp == "+":
        x = stack.pop()
        y = stack.pop()
        stack.append(x+y)
    elif inp == "-":
        x = stack.pop()
        y = stack.pop()
        stack.append(y-x)
    elif inp == "*":
        x = stack.pop()
        y = stack.pop()
        stack.append(x*y)
    else:
        stack.append(int(inp)) inp == "+" inp "+" x = stack.pop() x stack.pop() stack.pop stack pop y = stack.pop() y stack.pop() stack.pop stack pop stack.append(x+y) stack.append stack append x+y x y elif inp == "-":
        x = stack.pop()
        y = stack.pop()
        stack.append(y-x)
     inp == "-" inp "-" x = stack.pop() x stack.pop() stack.pop stack pop y = stack.pop() y stack.pop() stack.pop stack pop stack.append(y-x) stack.append stack append y-x y x elif inp == "*":
        x = stack.pop()
        y = stack.pop()
        stack.append(x*y)
     inp == "*" inp "*" x = stack.pop() x stack.pop() stack.pop stack pop y = stack.pop() y stack.pop() stack.pop stack pop stack.append(x*y) stack.append stack append x*y x y stack.append(int(inp)) stack.append stack append int(inp) int inp print(*stack) print *stack stack x = stack.pop() stack.pop() x y = stack.pop() stack.pop() y stack = [] [] stack y = stack.pop() stack.pop() y y = stack.pop() stack.pop() y a = input().split() input().split() a x = stack.pop() stack.pop() x x = stack.pop() stack.pop() x
a = input().split()

stack = []
for inp in a:
    if inp == "+":
        x = stack.pop()
        y = stack.pop()
        stack.append(x+y)
    elif inp == "-":
        x = stack.pop()
        y = stack.pop()
        stack.append(y-x)
    elif inp == "*":
        x = stack.pop()
        y = stack.pop()
        stack.append(x*y)
    else:
        stack.append(int(inp))

print(*stack)