import sys

for line in sys.stdin:
  items = line.strip().split()

stack = []

for item in items:
  if item == '+' or item == '-' or item == '*':
    x = stack.pop()
    y = stack.pop()
    exp = "%s %s %s" % (y, item, x)
    stack.append(eval(exp))
  else:
    stack.append(int(item))

print stack.pop() import sys sys for line in sys.stdin:
  items = line.strip().split() line sys.stdin sys stdin items = line.strip().split() items line.strip().split() line.strip().split line.strip() line.strip line strip split stack = [] stack [] for item in items:
  if item == '+' or item == '-' or item == '*':
    x = stack.pop()
    y = stack.pop()
    exp = "%s %s %s" % (y, item, x)
    stack.append(eval(exp))
  else:
    stack.append(int(item)) item items if item == '+' or item == '-' or item == '*':
    x = stack.pop()
    y = stack.pop()
    exp = "%s %s %s" % (y, item, x)
    stack.append(eval(exp))
  else:
    stack.append(int(item)) item == '+' or item == '-' or item == '*' item == '+' or item == '-' item == '+' item '+' item == '-' item '-' item == '*' item '*' x = stack.pop() x stack.pop() stack.pop stack pop y = stack.pop() y stack.pop() stack.pop stack pop exp = "%s %s %s" % (y, item, x) exp "%s %s %s" % (y, item, x) "%s %s %s" (y, item, x) y item x stack.append(eval(exp)) stack.append stack append eval(exp) eval exp stack.append(int(item)) stack.append stack append int(item) int item print stack.pop() stack.pop stack pop items = line.strip().split() line.strip().split() items stack = [] [] stack y = stack.pop() stack.pop() y exp = "%s %s %s" % (y, item, x) "%s %s %s" % (y, item, x) exp x = stack.pop() stack.pop() x
import sys

for line in sys.stdin:
  items = line.strip().split()

stack = []

for item in items:
  if item == '+' or item == '-' or item == '*':
    x = stack.pop()
    y = stack.pop()
    exp = "%s %s %s" % (y, item, x)
    stack.append(eval(exp))
  else:
    stack.append(int(item))

print stack.pop()