#! /usr/bin/env python
# -*- coding: utf-8 -*-

''' ???????????? '''

# pop???push??¨??????????????????????????????????????????????????¨??£??\????????????????????????
# ?¨??????????O(1)


operators = {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: x / y}


def compute(A):
    stack = []

    for i in range(len(A)):
        # ?????????
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
        if isinstance(A[i], int):
            stack.append(A[i])

    return stack[-1]

if __name__ == '__main__':
    A = list(input().split())
    # A = list("1 2 + 3 4 - *".split())

    for i in range(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

    print(compute(A)) ''' ???????????? ''' operators = {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: x / y} operators {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: x / y} "+" "+" lambda x, y: x + y x + y x y x y "-" "-" lambda x, y: x - y x - y x y x y "*" "*" lambda x, y: x * y x * y x y x y "/" "/" lambda x, y: x / y x / y x y x y def compute(A):
    stack = []

    for i in range(len(A)):
        # ?????????
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
        if isinstance(A[i], int):
            stack.append(A[i])

    return stack[-1] compute stack = [] stack [] for i in range(len(A)):
        # ?????????
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
        if isinstance(A[i], int):
            stack.append(A[i])

     i range(len(A)) range len(A) len A if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
         isinstance(A[i], str) isinstance A[i] A i str op_right = stack.pop() op_right stack.pop() stack.pop stack pop op_left = stack.pop() op_left stack.pop() stack.pop stack pop stack.append(operators[A[i]](op_left, op_right)) stack.append stack append operators[A[i]](op_left, op_right) [A[i]] operators A[i] A i op_left op_right if isinstance(A[i], int):
            stack.append(A[i])

     isinstance(A[i], int) isinstance A[i] A i int stack.append(A[i]) stack.append stack append A[i] A i return stack[-1] stack[-1] stack -1 A A if __name__ == '__main__':
    A = list(input().split())
    # A = list("1 2 + 3 4 - *".split())

    for i in range(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

    print(compute(A)) __name__ == '__main__' __name__ '__main__' A = list(input().split()) A list(input().split()) list input().split() ().split () input split for i in range(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

     i range(len(A)) range len(A) len A if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

     not A[i] in ['+', '-', '*', '/'] A[i] in ['+', '-', '*', '/'] A[i] A i ['+', '-', '*', '/'] '+' '-' '*' '/' A[i] = int(A[i]) A[i] A i int(A[i]) int A[i] A i print(compute(A)) print compute(A) compute A def compute(A):
    stack = []

    for i in range(len(A)):
        # ?????????
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
        if isinstance(A[i], int):
            stack.append(A[i])

    return stack[-1] def compute(A):
    stack = []

    for i in range(len(A)):
        # ?????????
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
        if isinstance(A[i], int):
            stack.append(A[i])

    return stack[-1] compute operators = {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: x / y} {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: x / y} operators A = list(input().split()) list(input().split()) A
#! /usr/bin/env python
# -*- coding: utf-8 -*-

''' ???????????? '''

# pop???push??¨??????????????????????????????????????????????????¨??£??\????????????????????????
# ?¨??????????O(1)


operators = {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: x / y}


def compute(A):
    stack = []

    for i in range(len(A)):
        # ?????????
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            # ?¨???????????????????????????????
            stack.append(operators[A[i]](op_left, op_right))

        # ???????????????
        if isinstance(A[i], int):
            stack.append(A[i])

    return stack[-1]

if __name__ == '__main__':
    A = list(input().split())
    # A = list("1 2 + 3 4 - *".split())

    for i in range(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

    print(compute(A))