rp = [ele for ele in input().split()]
op = ['+','-','*']
stack = []
for ele in rp:
	if ele not in op:
		# ele is number
		stack.append(eval(ele))
	else:
		# ele is operator
		num_2 = stack.pop()
		num_1 = stack.pop()
		if ele == '+':
			stack.append(num_1 + num_2)
		elif ele == '-':
			stack.append(num_1 - num_2)
		else:
			# ele == '*'
			stack.append(num_1 * num_2)
print(stack[0]) ele for ele in input().split() for ele in input().split() ele input().split() ().split () input split for ele in input().split() ele rp = [ele for ele in input().split()] rp [ele for ele in input().split()] op = ['+','-','*'] op ['+','-','*'] '+' '-' '*' stack = [] stack [] for ele in rp:
	if ele not in op:
		# ele is number
		stack.append(eval(ele))
	else:
		# ele is operator
		num_2 = stack.pop()
		num_1 = stack.pop()
		if ele == '+':
			stack.append(num_1 + num_2)
		elif ele == '-':
			stack.append(num_1 - num_2)
		else:
			# ele == '*'
			stack.append(num_1 * num_2) ele rp if ele not in op:
		# ele is number
		stack.append(eval(ele))
	else:
		# ele is operator
		num_2 = stack.pop()
		num_1 = stack.pop()
		if ele == '+':
			stack.append(num_1 + num_2)
		elif ele == '-':
			stack.append(num_1 - num_2)
		else:
			# ele == '*'
			stack.append(num_1 * num_2) ele not in op ele op stack.append(eval(ele)) stack.append stack append eval(ele) eval ele num_2 = stack.pop() num_2 stack.pop() stack.pop stack pop num_1 = stack.pop() num_1 stack.pop() stack.pop stack pop if ele == '+':
			stack.append(num_1 + num_2)
		elif ele == '-':
			stack.append(num_1 - num_2)
		else:
			# ele == '*'
			stack.append(num_1 * num_2) ele == '+' ele '+' stack.append(num_1 + num_2) stack.append stack append num_1 + num_2 num_1 num_2 elif ele == '-':
			stack.append(num_1 - num_2)
		 ele == '-' ele '-' stack.append(num_1 - num_2) stack.append stack append num_1 - num_2 num_1 num_2 stack.append(num_1 * num_2) stack.append stack append num_1 * num_2 num_1 num_2 print(stack[0]) print stack[0] stack 0 stack = [] [] stack num_1 = stack.pop() stack.pop() num_1 rp = [ele for ele in input().split()] [ele for ele in input().split()] rp num_2 = stack.pop() stack.pop() num_2 op = ['+','-','*'] ['+','-','*'] op
rp = [ele for ele in input().split()]
op = ['+','-','*']
stack = []
for ele in rp:
	if ele not in op:
		# ele is number
		stack.append(eval(ele))
	else:
		# ele is operator
		num_2 = stack.pop()
		num_1 = stack.pop()
		if ele == '+':
			stack.append(num_1 + num_2)
		elif ele == '-':
			stack.append(num_1 - num_2)
		else:
			# ele == '*'
			stack.append(num_1 * num_2)
print(stack[0])