stack = []
for i in input().split():
  if i in ['+', '-', '*']:
    b, a = stack.pop(), stack.pop()
    if i == '+': stack.append(a + b)
    if i == '-': stack.append(a - b)
    if i == '*': stack.append(a * b)
  else:
    stack.append(int(i))
print(stack.pop()) stack = [] stack [] for i in input().split():
  if i in ['+', '-', '*']:
    b, a = stack.pop(), stack.pop()
    if i == '+': stack.append(a + b)
    if i == '-': stack.append(a - b)
    if i == '*': stack.append(a * b)
  else:
    stack.append(int(i)) i input().split() ().split () input split if i in ['+', '-', '*']:
    b, a = stack.pop(), stack.pop()
    if i == '+': stack.append(a + b)
    if i == '-': stack.append(a - b)
    if i == '*': stack.append(a * b)
  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(a + b)
     i == '+' i '+' if i == '-': stack.append(a - b)
     i == '-' i '-' if i == '*': stack.append(a * b)
   i == '*' i '*' stack.append(int(i)) stack.append stack append int(i) int i print(stack.pop()) print stack.pop() stack.pop stack pop stack = [] [] stack a = stack.pop(), stack.pop() stack.pop() a b, a = stack.pop(), stack.pop() stack.pop() b
stack = []
for i in input().split():
  if i in ['+', '-', '*']:
    b, a = stack.pop(), stack.pop()
    if i == '+': stack.append(a + b)
    if i == '-': stack.append(a - b)
    if i == '*': stack.append(a * b)
  else:
    stack.append(int(i))
print(stack.pop())