# -*- coding: utf-8 -*-

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


def calculation(A):
    stack = []

    for i in xrange(len(A)):
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            stack.append(operators[A[i]](op_left, op_right))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
    return stack[-1]

if __name__ == '__main__':
    A = raw_input().split()
    # A = [1, 2, '+', 3, 4, '-', '*']
    for i in xrange(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

    print calculation(A) operators = {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: float(x) / y} operators {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: float(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: float(x) / y float(x) / y float(x) float x y x y def calculation(A):
    stack = []

    for i in xrange(len(A)):
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            stack.append(operators[A[i]](op_left, op_right))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
    return stack[-1] calculation stack = [] stack [] for i in xrange(len(A)):
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            stack.append(operators[A[i]](op_left, op_right))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
     i xrange(len(A)) xrange 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))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
     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 elif isinstance(A[i], int):
            stack.append(int(A[i]))
     isinstance(A[i], int) isinstance A[i] A i int stack.append(int(A[i])) stack.append stack append int(A[i]) int A[i] A i return stack[-1] stack[-1] stack -1 A A if __name__ == '__main__':
    A = raw_input().split()
    # A = [1, 2, '+', 3, 4, '-', '*']
    for i in xrange(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

    print calculation(A) __name__ == '__main__' __name__ '__main__' A = raw_input().split() A raw_input().split() ().split () raw_input split for i in xrange(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

     i xrange(len(A)) xrange 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 calculation(A) calculation A A = raw_input().split() raw_input().split() A operators = {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: float(x) / y} {"+": lambda x, y: x + y,
             "-": lambda x, y: x - y,
             "*": lambda x, y: x * y,
             "/": lambda x, y: float(x) / y} operators def calculation(A):
    stack = []

    for i in xrange(len(A)):
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            stack.append(operators[A[i]](op_left, op_right))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
    return stack[-1] def calculation(A):
    stack = []

    for i in xrange(len(A)):
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            stack.append(operators[A[i]](op_left, op_right))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
    return stack[-1] calculation
# -*- coding: utf-8 -*-

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


def calculation(A):
    stack = []

    for i in xrange(len(A)):
        if isinstance(A[i], str):
            op_right = stack.pop()
            op_left = stack.pop()
            stack.append(operators[A[i]](op_left, op_right))
        elif isinstance(A[i], int):
            stack.append(int(A[i]))
    return stack[-1]

if __name__ == '__main__':
    A = raw_input().split()
    # A = [1, 2, '+', 3, 4, '-', '*']
    for i in xrange(len(A)):
        if not A[i] in ['+', '-', '*', '/']:
            A[i] = int(A[i])

    print calculation(A)