inputs = input().split(" ")
stack = []

for str in inputs:
  if str.isdigit():
    stack.append(int(str))
  else:
    b = stack.pop()
    a = stack.pop()
    if str == '+':
      stack.append(a + b)
    elif str == '-':
      stack.append(a - b)
    elif str == '*':
      stack.append(a * b)

print(stack.pop()) inputs = input().split(" ") inputs input().split(" ") ().split () input split " " stack = [] stack [] for str in inputs:
  if str.isdigit():
    stack.append(int(str))
  else:
    b = stack.pop()
    a = stack.pop()
    if str == '+':
      stack.append(a + b)
    elif str == '-':
      stack.append(a - b)
    elif str == '*':
      stack.append(a * b) str inputs if str.isdigit():
    stack.append(int(str))
  else:
    b = stack.pop()
    a = stack.pop()
    if str == '+':
      stack.append(a + b)
    elif str == '-':
      stack.append(a - b)
    elif str == '*':
      stack.append(a * b) str.isdigit() str.isdigit str isdigit stack.append(int(str)) stack.append stack append int(str) int str b = stack.pop() b stack.pop() stack.pop stack pop a = stack.pop() a stack.pop() stack.pop stack pop if str == '+':
      stack.append(a + b)
    elif str == '-':
      stack.append(a - b)
    elif str == '*':
      stack.append(a * b) str == '+' str '+' stack.append(a + b) stack.append stack append a + b a b elif str == '-':
      stack.append(a - b)
     str == '-' str '-' stack.append(a - b) stack.append stack append a - b a b elif str == '*':
      stack.append(a * b) str == '*' str '*' stack.append(a * b) stack.append stack append a * b a b print(stack.pop()) print stack.pop() stack.pop stack pop inputs = input().split(" ") input().split(" ") inputs stack = [] [] stack a = stack.pop() stack.pop() a b = stack.pop() stack.pop() b
inputs = input().split(" ")
stack = []

for str in inputs:
  if str.isdigit():
    stack.append(int(str))
  else:
    b = stack.pop()
    a = stack.pop()
    if str == '+':
      stack.append(a + b)
    elif str == '-':
      stack.append(a - b)
    elif str == '*':
      stack.append(a * b)

print(stack.pop())
