"RPN using stack for AOJ ALDS1_3_A: Stack"

# coding: utf-8


def rpn(exp):
    """
    rpn calculation
    >>> rpn(['1', '2', '+', '3', '4', '-', '*'])
    -3
    """

    stack = []
    for elem in exp:
        if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

    print(stack.pop())


def main():
    "main function"

    exp = list(input().split(' '))
    rpn(exp)

if __name__ == '__main__':
    # import doctest
    # doctest.testmod()

    main() "RPN using stack for AOJ ALDS1_3_A: Stack" def rpn(exp):
    """
    rpn calculation
    >>> rpn(['1', '2', '+', '3', '4', '-', '*'])
    -3
    """

    stack = []
    for elem in exp:
        if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

    print(stack.pop()) rpn """
    rpn calculation
    >>> rpn(['1', '2', '+', '3', '4', '-', '*'])
    -3
    """ stack = [] stack [] for elem in exp:
        if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

     elem exp if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

     elem == '+' elem '+' stack.append(int(stack.pop()) + int(stack.pop())) stack.append stack append int(stack.pop()) + int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
         elem == '-' elem '-' stack.append(-int(stack.pop()) + int(stack.pop())) stack.append stack append -int(stack.pop()) + int(stack.pop()) -int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
         elem == '*' elem '*' stack.append(int(stack.pop()) * int(stack.pop())) stack.append stack append int(stack.pop()) * int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
         elem == '/' elem '/' stack.append(int(stack.pop()) / int(stack.pop())) stack.append stack append int(stack.pop()) / int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop stack.append(elem) stack.append stack append elem print(stack.pop()) print stack.pop() stack.pop stack pop exp exp def main():
    "main function"

    exp = list(input().split(' '))
    rpn(exp) main "main function" exp = list(input().split(' ')) exp list(input().split(' ')) list input().split(' ') ().split () input split ' ' rpn(exp) rpn exp if __name__ == '__main__':
    # import doctest
    # doctest.testmod()

    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    "main function"

    exp = list(input().split(' '))
    rpn(exp) def main():
    "main function"

    exp = list(input().split(' '))
    rpn(exp) main def rpn(exp):
    """
    rpn calculation
    >>> rpn(['1', '2', '+', '3', '4', '-', '*'])
    -3
    """

    stack = []
    for elem in exp:
        if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

    print(stack.pop()) def rpn(exp):
    """
    rpn calculation
    >>> rpn(['1', '2', '+', '3', '4', '-', '*'])
    -3
    """

    stack = []
    for elem in exp:
        if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

    print(stack.pop()) rpn
"RPN using stack for AOJ ALDS1_3_A: Stack"

# coding: utf-8


def rpn(exp):
    """
    rpn calculation
    >>> rpn(['1', '2', '+', '3', '4', '-', '*'])
    -3
    """

    stack = []
    for elem in exp:
        if elem == '+':
            stack.append(int(stack.pop()) + int(stack.pop()))
        elif elem == '-':
            stack.append(-int(stack.pop()) + int(stack.pop()))
        elif elem == '*':
            stack.append(int(stack.pop()) * int(stack.pop()))
        elif elem == '/':
            stack.append(int(stack.pop()) / int(stack.pop()))
        else:
            stack.append(elem)

    print(stack.pop())


def main():
    "main function"

    exp = list(input().split(' '))
    rpn(exp)

if __name__ == '__main__':
    # import doctest
    # doctest.testmod()

    main()