x = input().split()

A = []

for i in x:

    try:

        A.append(int(i))

    except:

        b = A.pop()

        a = A.pop()

        if i == '+':

            A.append(a + b)

        if i == '-':

            A.append(a - b)

        if i == '*':

            A.append(a * b)

print((A.pop()))
inList = input().split()

stack = []

for i in inList:

    if i in ['+', '-', '*']:

        b, a = stack.pop(), stack.pop()

        if i == '+':

            stack.append(b + a)

        if i == '-':

            stack.append(a - b)

        if i == '*':

            stack.append(b * a)

    else:

        stack.append(int(i))

print((stack.pop()))
x = input().split()
A = []
for i in x:
    try:
        A.append(int(i))
    except:
        b = A.pop()
        a = A.pop()
        if i == "+":
            A.append(a + b)
        if i == "-":
            A.append(a - b)
        if i == "*":
            A.append(a * b)
print((A.pop()))

inList = input().split()
stack = []
for i in inList:
    if i in ["+", "-", "*"]:
        b, a = stack.pop(), stack.pop()
        if i == "+":
            stack.append(b + a)
        if i == "-":
            stack.append(a - b)
        if i == "*":
            stack.append(b * a)
    else:
        stack.append(int(i))
print((stack.pop()))

-x = input().split() -A = [] -for i in x: -    try: -        A.append(int(i)) -    except: -        b = A.pop() -        a = A.pop() +inList = input().split() +stack = [] +for i in inList: +    if i in ["+", "-", "*"]: +        b, a = stack.pop(), stack.pop() -            A.append(a + b) +            stack.append(b + a) -            A.append(a - b) +            stack.append(a - b) -            A.append(a * b) -print((A.pop())) +            stack.append(b * a) +    else: +        stack.append(int(i)) +print((stack.pop()))