#!/usr/bin/env python
# encoding: utf-8


class Solution:
    @staticmethod
    def stack_polish_calc():
        # write your code here
        # array_length = int(input())
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        # print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc() class Solution:
    @staticmethod
    def stack_polish_calc():
        # write your code here
        # array_length = int(input())
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        # print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result) Solution def stack_polish_calc():
        # write your code here
        # array_length = int(input())
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        # print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result) stack_polish_calc calc_func = ('+', '-', '*') calc_func ('+', '-', '*') '+' '-' '*' str(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() str(x) str x array = [str(x) for x in input().split()] array [str(x) for x in input().split()] result = [] result [] for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

         i range(len(array)) range len(array) len array if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

         array[i] not in calc_func array[i] array i calc_func result.append(str(array[i])) result.append result append str(array[i]) str array[i] array i calc = array[i] calc array[i] array i arg_2 = result.pop() arg_2 result.pop() result.pop result pop arg_1 = result.pop() arg_1 result.pop() result.pop result pop result.append(str(eval(''.join((str(arg_1), calc, str(arg_2)))))) result.append result append str(eval(''.join((str(arg_1), calc, str(arg_2))))) str eval(''.join((str(arg_1), calc, str(arg_2)))) eval ''.join((str(arg_1), calc, str(arg_2))) ''.join '' join (str(arg_1), calc, str(arg_2)) str(arg_1) str arg_1 calc str(arg_2) str arg_2 print(*result) print *result result @staticmethod
     stack_polish_calc staticmethod stack_polish_calc if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc() __name__ == '__main__' __name__ '__main__' solution = Solution() solution Solution() Solution solution.stack_polish_calc() solution.stack_polish_calc solution stack_polish_calc solution = Solution() Solution() solution class Solution:
    @staticmethod
    def stack_polish_calc():
        # write your code here
        # array_length = int(input())
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        # print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result) class Solution:
    @staticmethod
    def stack_polish_calc():
        # write your code here
        # array_length = int(input())
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        # print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result) Solution
#!/usr/bin/env python
# encoding: utf-8


class Solution:
    @staticmethod
    def stack_polish_calc():
        # write your code here
        # array_length = int(input())
        calc_func = ('+', '-', '*')
        array = [str(x) for x in input().split()]
        # print(array)
        result = []
        for i in range(len(array)):
            if array[i] not in calc_func:
                result.append(str(array[i]))
            else:
                calc = array[i]
                arg_2 = result.pop()
                arg_1 = result.pop()
                result.append(str(eval(''.join((str(arg_1), calc, str(arg_2))))))

        print(*result)


if __name__ == '__main__':
    solution = Solution()
    solution.stack_polish_calc()