def isop(s):
    if s == "+" or s == "-" or s == "*":
        return True
    return False


def main():
    line = list(input().split())
    stack = []
    while len(line) > 0:
        tmp = line.pop()
        if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
        while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

    print(*stack)


if __name__ == '__main__':
    main() def isop(s):
    if s == "+" or s == "-" or s == "*":
        return True
    return False isop if s == "+" or s == "-" or s == "*":
        return True
     s == "+" or s == "-" or s == "*" s == "+" or s == "-" s == "+" s "+" s == "-" s "-" s == "*" s "*" return True True return False False s s def main():
    line = list(input().split())
    stack = []
    while len(line) > 0:
        tmp = line.pop()
        if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
        while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

    print(*stack) main line = list(input().split()) line list(input().split()) list input().split() ().split () input split stack = [] stack [] while len(line) > 0:
        tmp = line.pop()
        if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
        while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

     len(line) > 0 len(line) len line 0 tmp = line.pop() tmp line.pop() line.pop line pop if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
         isop(tmp) isop tmp stack.append(tmp) stack.append stack append tmp stack.append(int(tmp)) stack.append stack append int(tmp) int tmp while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

     len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False len(stack) > 2 and isop(stack[-1]) == False len(stack) > 2 len(stack) len stack 2 isop(stack[-1]) == False isop(stack[-1]) isop stack[-1] stack -1 False isop(stack[-2]) == False isop(stack[-2]) isop stack[-2] stack -2 False num1 = stack.pop(-1) num1 stack.pop(-1) stack.pop stack pop -1 num2 = stack.pop(-1) num2 stack.pop(-1) stack.pop stack pop -1 op = stack.pop(-1) op stack.pop(-1) stack.pop stack pop -1 if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

     op == "+" op "+" stack.append(num1 + num2) stack.append stack append num1 + num2 num1 num2 elif op == "-":
                stack.append(num1 - num2)
             op == "-" op "-" stack.append(num1 - num2) stack.append stack append num1 - num2 num1 num2 stack.append(num1 * num2) stack.append stack append num1 * num2 num1 num2 print(*stack) print *stack stack if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def isop(s):
    if s == "+" or s == "-" or s == "*":
        return True
    return False def isop(s):
    if s == "+" or s == "-" or s == "*":
        return True
    return False isop def main():
    line = list(input().split())
    stack = []
    while len(line) > 0:
        tmp = line.pop()
        if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
        while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

    print(*stack) def main():
    line = list(input().split())
    stack = []
    while len(line) > 0:
        tmp = line.pop()
        if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
        while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

    print(*stack) main
def isop(s):
    if s == "+" or s == "-" or s == "*":
        return True
    return False


def main():
    line = list(input().split())
    stack = []
    while len(line) > 0:
        tmp = line.pop()
        if isop(tmp):
            stack.append(tmp)
        else:
            stack.append(int(tmp))
        while len(stack) > 2 and isop(stack[-1]) == False and isop(stack[-2]) == False:
            num1 = stack.pop(-1)
            num2 = stack.pop(-1)
            op = stack.pop(-1)
            if op == "+":
                stack.append(num1 + num2)
            elif op == "-":
                stack.append(num1 - num2)
            else:
                stack.append(num1 * num2)

    print(*stack)


if __name__ == '__main__':
    main()
