inList = input().split()
stack = []
for i in inList:
    if i in ['+', '-', '*']:
        b, a = stack.pop(), stack.pop()
        if i == '+':
            stack.append(b + a)
        if i == '-':
            stack.append(a - b)
        if i == '*':
            stack.append(b * a)
    else:
        stack.append(int(i))
print(stack.pop()) inList = input().split() inList input().split() ().split () input split stack = [] stack [] for i in inList:
    if i in ['+', '-', '*']:
        b, a = stack.pop(), stack.pop()
        if i == '+':
            stack.append(b + a)
        if i == '-':
            stack.append(a - b)
        if i == '*':
            stack.append(b * a)
    else:
        stack.append(int(i)) i inList if i in ['+', '-', '*']:
        b, a = stack.pop(), stack.pop()
        if i == '+':
            stack.append(b + a)
        if i == '-':
            stack.append(a - b)
        if i == '*':
            stack.append(b * a)
    else:
        stack.append(int(i)) i in ['+', '-', '*'] i ['+', '-', '*'] '+' '-' '*' b, a = stack.pop(), stack.pop() b stack.pop() stack.pop stack pop a stack.pop() stack.pop stack pop if i == '+':
            stack.append(b + a)
         i == '+' i '+' stack.append(b + a) stack.append stack append b + a b a if i == '-':
            stack.append(a - b)
         i == '-' i '-' stack.append(a - b) stack.append stack append a - b a b if i == '*':
            stack.append(b * a)
     i == '*' i '*' stack.append(b * a) stack.append stack append b * a b a stack.append(int(i)) stack.append stack append int(i) int i print(stack.pop()) print stack.pop() stack.pop stack pop inList = input().split() input().split() inList b, a = stack.pop(), stack.pop() stack.pop() b stack = [] [] stack a = stack.pop(), stack.pop() stack.pop() a
inList = input().split()
stack = []
for i in inList:
    if i in ['+', '-', '*']:
        b, a = stack.pop(), stack.pop()
        if i == '+':
            stack.append(b + a)
        if i == '-':
            stack.append(a - b)
        if i == '*':
            stack.append(b * a)
    else:
        stack.append(int(i))
print(stack.pop())