class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value

sequence = raw_input().split()
operators = {"*": "*", "+": "+", "-": "-"}
stack = MyStack()
for s in sequence:
    if s in operators:
        value2 = stack.pop()
        value1 = stack.pop()
        stack.push(str(eval(value1 + operators[s] + value2)))
    else:
        stack.push(s)

print(stack.pop()) class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value MyStack """stack class

    Attributes:
        stack: stack
    """ def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

     __init__ self.stack = [0] * 1000 self.stack self stack [0] * 1000 [0] 0 1000 self.top = 0 self.top self top 0 self self def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

     pop """pop method

        Returns:
            popped object
        """ if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

     self.top - 1 < 0 self.top - 1 self.top self top 1 0 print("Stack Underflow") print "Stack Underflow" value = self.stack[self.top] value self.stack[self.top] self.stack self stack self.top self top self.stack[self.top] = 0 self.stack[self.top] self.stack self stack self.top self top 0 self.top -= 1 self.top self top 1 return value value self self def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value push """ push method
        Args:
            value: value to be pushed
        """ if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value self.top + 1 >= len(self.stack) self.top + 1 self.top self top 1 len(self.stack) len self.stack self stack print("Stack Overflow") print "Stack Overflow" self.top += 1 self.top self top 1 self.stack[self.top] = value self.stack[self.top] self.stack self stack self.top self top value self self value value object sequence = raw_input().split() sequence raw_input().split() ().split () raw_input split operators = {"*": "*", "+": "+", "-": "-"} operators {"*": "*", "+": "+", "-": "-"} "*" "*" "*" "+" "+" "+" "-" "-" "-" stack = MyStack() stack MyStack() MyStack for s in sequence:
    if s in operators:
        value2 = stack.pop()
        value1 = stack.pop()
        stack.push(str(eval(value1 + operators[s] + value2)))
    else:
        stack.push(s) s sequence if s in operators:
        value2 = stack.pop()
        value1 = stack.pop()
        stack.push(str(eval(value1 + operators[s] + value2)))
    else:
        stack.push(s) s in operators s operators value2 = stack.pop() value2 stack.pop() stack.pop stack pop value1 = stack.pop() value1 stack.pop() stack.pop stack pop stack.push(str(eval(value1 + operators[s] + value2))) stack.push stack push str(eval(value1 + operators[s] + value2)) str eval(value1 + operators[s] + value2) eval value1 + operators[s] + value2 value1 + operators[s] value1 operators[s] operators s value2 stack.push(s) stack.push stack push s print(stack.pop()) print stack.pop() stack.pop stack pop sequence = raw_input().split() raw_input().split() sequence stack = MyStack() MyStack() stack value1 = stack.pop() stack.pop() value1 class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value MyStack value2 = stack.pop() stack.pop() value2 operators = {"*": "*", "+": "+", "-": "-"} {"*": "*", "+": "+", "-": "-"} operators
class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value

sequence = raw_input().split()
operators = {"*": "*", "+": "+", "-": "-"}
stack = MyStack()
for s in sequence:
    if s in operators:
        value2 = stack.pop()
        value1 = stack.pop()
        stack.push(str(eval(value1 + operators[s] + value2)))
    else:
        stack.push(s)

print(stack.pop())