s = raw_input()
l = s.split(' ')
stk = []

for i in l:
  if i in ['+','-','*','/']:
    b = stk.pop()
    a = stk.pop()
    if i == '+':
      c = a+b
      stk.append(c)
    elif i == '-':
      c = a-b
      stk.append(c)
    elif i == '*':
      c = a * b
      stk.append(c)
    elif i == '/':
      c = a / b
      stk.append(c)
  else:
    stk.append(int(i))
print stk[0] s = raw_input() s raw_input() raw_input l = s.split(' ') l s.split(' ') s.split s split ' ' stk = [] stk [] for i in l:
  if i in ['+','-','*','/']:
    b = stk.pop()
    a = stk.pop()
    if i == '+':
      c = a+b
      stk.append(c)
    elif i == '-':
      c = a-b
      stk.append(c)
    elif i == '*':
      c = a * b
      stk.append(c)
    elif i == '/':
      c = a / b
      stk.append(c)
  else:
    stk.append(int(i)) i l if i in ['+','-','*','/']:
    b = stk.pop()
    a = stk.pop()
    if i == '+':
      c = a+b
      stk.append(c)
    elif i == '-':
      c = a-b
      stk.append(c)
    elif i == '*':
      c = a * b
      stk.append(c)
    elif i == '/':
      c = a / b
      stk.append(c)
  else:
    stk.append(int(i)) i in ['+','-','*','/'] i ['+','-','*','/'] '+' '-' '*' '/' b = stk.pop() b stk.pop() stk.pop stk pop a = stk.pop() a stk.pop() stk.pop stk pop if i == '+':
      c = a+b
      stk.append(c)
    elif i == '-':
      c = a-b
      stk.append(c)
    elif i == '*':
      c = a * b
      stk.append(c)
    elif i == '/':
      c = a / b
      stk.append(c)
   i == '+' i '+' c = a+b c a+b a b stk.append(c) stk.append stk append c elif i == '-':
      c = a-b
      stk.append(c)
     i == '-' i '-' c = a-b c a-b a b stk.append(c) stk.append stk append c elif i == '*':
      c = a * b
      stk.append(c)
     i == '*' i '*' c = a * b c a * b a b stk.append(c) stk.append stk append c elif i == '/':
      c = a / b
      stk.append(c)
   i == '/' i '/' c = a / b c a / b a b stk.append(c) stk.append stk append c stk.append(int(i)) stk.append stk append int(i) int i print stk[0] stk 0 b = stk.pop() stk.pop() b c = a / b a / b c a = stk.pop() stk.pop() a l = s.split(' ') s.split(' ') l c = a-b a-b c stk = [] [] stk c = a * b a * b c c = a+b a+b c s = raw_input() raw_input() s
s = raw_input()
l = s.split(' ')
stk = []

for i in l:
  if i in ['+','-','*','/']:
    b = stk.pop()
    a = stk.pop()
    if i == '+':
      c = a+b
      stk.append(c)
    elif i == '-':
      c = a-b
      stk.append(c)
    elif i == '*':
      c = a * b
      stk.append(c)
    elif i == '/':
      c = a / b
      stk.append(c)
  else:
    stk.append(int(i))
print stk[0]