s = input().split()

stack = []
for i in s:
    if i.isdigit():
        stack.append(int(i))
    else:
        if i == "+":
            f = lambda x, y: x + y
        elif i == "-":
            f = lambda x, y: x - y
        elif i == "*":
            f = lambda x, y: x * y

        y = stack.pop()
        x = stack.pop()
        stack.append(f(x, y))

print(stack[0]) s = input().split() s input().split() ().split () input split stack = [] stack [] for i in s:
    if i.isdigit():
        stack.append(int(i))
    else:
        if i == "+":
            f = lambda x, y: x + y
        elif i == "-":
            f = lambda x, y: x - y
        elif i == "*":
            f = lambda x, y: x * y

        y = stack.pop()
        x = stack.pop()
        stack.append(f(x, y)) i s if i.isdigit():
        stack.append(int(i))
    else:
        if i == "+":
            f = lambda x, y: x + y
        elif i == "-":
            f = lambda x, y: x - y
        elif i == "*":
            f = lambda x, y: x * y

        y = stack.pop()
        x = stack.pop()
        stack.append(f(x, y)) i.isdigit() i.isdigit i isdigit stack.append(int(i)) stack.append stack append int(i) int i if i == "+":
            f = lambda x, y: x + y
        elif i == "-":
            f = lambda x, y: x - y
        elif i == "*":
            f = lambda x, y: x * y

         i == "+" i "+" f = lambda x, y: x + y f lambda x, y: x + y x + y x y x y elif i == "-":
            f = lambda x, y: x - y
         i == "-" i "-" f = lambda x, y: x - y f lambda x, y: x - y x - y x y x y elif i == "*":
            f = lambda x, y: x * y

         i == "*" i "*" f = lambda x, y: x * y f lambda x, y: x * y x * y x y x y y = stack.pop() y stack.pop() stack.pop stack pop x = stack.pop() x stack.pop() stack.pop stack pop stack.append(f(x, y)) stack.append stack append f(x, y) f x y print(stack[0]) print stack[0] stack 0 f = lambda x, y: x * y lambda x, y: x * y f stack = [] [] stack f = lambda x, y: x + y lambda x, y: x + y f x = stack.pop() stack.pop() x s = input().split() input().split() s f = lambda x, y: x - y lambda x, y: x - y f y = stack.pop() stack.pop() y
s = input().split()

stack = []
for i in s:
    if i.isdigit():
        stack.append(int(i))
    else:
        if i == "+":
            f = lambda x, y: x + y
        elif i == "-":
            f = lambda x, y: x - y
        elif i == "*":
            f = lambda x, y: x * y

        y = stack.pop()
        x = stack.pop()
        stack.append(f(x, y))

print(stack[0])
