def main():
    stack = []
    for char in input().split():
        if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

    print(stack[0])
    return


main() def main():
    stack = []
    for char in input().split():
        if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

    print(stack[0])
    return main stack = [] stack [] for char in input().split():
        if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

     char input().split() ().split () input split if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

     char in ['+', '-', '*'] char ['+', '-', '*'] '+' '-' '*' right = int(stack.pop()) right int(stack.pop()) int stack.pop() stack.pop stack pop left = int(stack.pop()) left int(stack.pop()) int stack.pop() stack.pop stack pop if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
             char == '+' char '+' c = left + right c left + right left right elif char == '-':
                c = left - right
             char == '-' char '-' c = left - right c left - right left right elif char == '*':
                c = left * right
             char == '*' char '*' c = left * right c left * right left right raise AssertionError AssertionError stack.append(c) stack.append stack append c stack.append(int(char)) stack.append stack append int(char) int char print(stack[0]) print stack[0] stack 0 return main() main def main():
    stack = []
    for char in input().split():
        if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

    print(stack[0])
    return def main():
    stack = []
    for char in input().split():
        if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

    print(stack[0])
    return main
def main():
    stack = []
    for char in input().split():
        if char in ['+', '-', '*']:
            right = int(stack.pop())
            left = int(stack.pop())
            if char == '+':
                c = left + right
            elif char == '-':
                c = left - right
            elif char == '*':
                c = left * right
            else:
                raise AssertionError
            stack.append(c)
        else:
            stack.append(int(char))

    print(stack[0])
    return


main()
