import sys

class Stack:
    def __init__(self, max):
        self.max = max
        self.stack = list(range(max))
        self.top = 0

    def push(self, value):
        if self.top == self.max:
            raise IndexError('?????????????????????????????????')

        self.stack[self.top] = value
        self.top += 1

    def pop(self):
        if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

        self.top -= 1
        return self.stack[self.top]

def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = Stack(100)
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

    print(stack.pop())
    
if __name__ == '__main__':
    main() import sys sys class Stack:
    def __init__(self, max):
        self.max = max
        self.stack = list(range(max))
        self.top = 0

    def push(self, value):
        if self.top == self.max:
            raise IndexError('?????????????????????????????????')

        self.stack[self.top] = value
        self.top += 1

    def pop(self):
        if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

        self.top -= 1
        return self.stack[self.top] Stack def __init__(self, max):
        self.max = max
        self.stack = list(range(max))
        self.top = 0

     __init__ self.max = max self.max self max max self.stack = list(range(max)) self.stack self stack list(range(max)) list range(max) range max self.top = 0 self.top self top 0 self self max max def push(self, value):
        if self.top == self.max:
            raise IndexError('?????????????????????????????????')

        self.stack[self.top] = value
        self.top += 1

     push if self.top == self.max:
            raise IndexError('?????????????????????????????????')

         self.top == self.max self.top self top self.max self max raise IndexError('?????????????????????????????????') IndexError('?????????????????????????????????') IndexError '?????????????????????????????????' self.stack[self.top] = value self.stack[self.top] self.stack self stack self.top self top value self.top += 1 self.top self top 1 self self value value def pop(self):
        if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

        self.top -= 1
        return self.stack[self.top] pop if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

         self.top == 0 self.top self top 0 raise IndexError('??????????????????????????¨??????') IndexError('??????????????????????????¨??????') IndexError '??????????????????????????¨??????' self.top -= 1 self.top self top 1 return self.stack[self.top] self.stack[self.top] self.stack self stack self.top self top self self def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = Stack(100)
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

    print(stack.pop())
     main expr = sys.stdin.readline().strip().split(' ') expr sys.stdin.readline().strip().split(' ') sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split ' ' stack = Stack(100) stack Stack(100) Stack 100 for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

     i expr if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

     i == '*' or i == '+' or i == '-' i == '*' or i == '+' i == '*' i '*' i == '+' i '+' i == '-' i '-' n1 = stack.pop() n1 stack.pop() stack.pop stack pop n2 = stack.pop() n2 stack.pop() stack.pop stack pop ans = eval(n2 + i + n1) ans eval(n2 + i + n1) eval n2 + i + n1 n2 + i n2 i n1 stack.push(str(ans)) stack.push stack push str(ans) str ans stack.push(i) stack.push stack push i print(stack.pop()) print stack.pop() stack.pop stack pop if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main class Stack:
    def __init__(self, max):
        self.max = max
        self.stack = list(range(max))
        self.top = 0

    def push(self, value):
        if self.top == self.max:
            raise IndexError('?????????????????????????????????')

        self.stack[self.top] = value
        self.top += 1

    def pop(self):
        if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

        self.top -= 1
        return self.stack[self.top] class Stack:
    def __init__(self, max):
        self.max = max
        self.stack = list(range(max))
        self.top = 0

    def push(self, value):
        if self.top == self.max:
            raise IndexError('?????????????????????????????????')

        self.stack[self.top] = value
        self.top += 1

    def pop(self):
        if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

        self.top -= 1
        return self.stack[self.top] Stack def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = Stack(100)
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

    print(stack.pop())
     def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = Stack(100)
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

    print(stack.pop())
     main
import sys

class Stack:
    def __init__(self, max):
        self.max = max
        self.stack = list(range(max))
        self.top = 0

    def push(self, value):
        if self.top == self.max:
            raise IndexError('?????????????????????????????????')

        self.stack[self.top] = value
        self.top += 1

    def pop(self):
        if self.top == 0:
            raise IndexError('??????????????????????????¨??????')

        self.top -= 1
        return self.stack[self.top]

def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = Stack(100)
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.push(str(ans))
        else:
            stack.push(i)

    print(stack.pop())
    
if __name__ == '__main__':
    main()