import sys

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

    print(stack.pop())
    
if __name__ == '__main__':
    main() import sys sys def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = []
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.append(str(ans))
        else:
            stack.append(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 [] for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.append(str(ans))
        else:
            stack.append(i)

     i expr if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.append(str(ans))
        else:
            stack.append(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.append(str(ans)) stack.append stack append str(ans) str ans stack.append(i) stack.append stack append i print(stack.pop()) print stack.pop() stack.pop stack pop if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    expr = sys.stdin.readline().strip().split(' ')
    stack = []
    
    for i in expr:
        if i == '*' or i == '+' or i == '-':
            n1 = stack.pop()
            n2 = stack.pop()
            ans = eval(n2 + i + n1)
            stack.append(str(ans))
        else:
            stack.append(i)

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

    print(stack.pop())
     main
import sys

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

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