line= input().split(" ")
op = ["+","-","*"]

stack = []

def push(i):
	stack.append(i)

def pop(i):
	return stack.pop(i)

for i in line:
	if i not in op:
		push(int(i))
	else:
		if i == "+":
			push(pop(-1) + pop(-1))
		elif i == "-":
			push(pop(-2) - pop(-1))
		elif i == "*":
			push(pop(-1) * pop(-1))

print(*stack)
 line= input().split(" ") line input().split(" ") ().split () input split " " op = ["+","-","*"] op ["+","-","*"] "+" "-" "*" stack = [] stack [] def push(i):
	stack.append(i) push stack.append(i) stack.append stack append i i i def pop(i):
	return stack.pop(i) pop return stack.pop(i) stack.pop(i) stack.pop stack pop i i i for i in line:
	if i not in op:
		push(int(i))
	else:
		if i == "+":
			push(pop(-1) + pop(-1))
		elif i == "-":
			push(pop(-2) - pop(-1))
		elif i == "*":
			push(pop(-1) * pop(-1)) i line if i not in op:
		push(int(i))
	else:
		if i == "+":
			push(pop(-1) + pop(-1))
		elif i == "-":
			push(pop(-2) - pop(-1))
		elif i == "*":
			push(pop(-1) * pop(-1)) i not in op i op push(int(i)) push int(i) int i if i == "+":
			push(pop(-1) + pop(-1))
		elif i == "-":
			push(pop(-2) - pop(-1))
		elif i == "*":
			push(pop(-1) * pop(-1)) i == "+" i "+" push(pop(-1) + pop(-1)) push pop(-1) + pop(-1) pop(-1) pop -1 pop(-1) pop -1 elif i == "-":
			push(pop(-2) - pop(-1))
		 i == "-" i "-" push(pop(-2) - pop(-1)) push pop(-2) - pop(-1) pop(-2) pop -2 pop(-1) pop -1 elif i == "*":
			push(pop(-1) * pop(-1)) i == "*" i "*" push(pop(-1) * pop(-1)) push pop(-1) * pop(-1) pop(-1) pop -1 pop(-1) pop -1 print(*stack) print *stack stack line= input().split(" ") input().split(" ") line def push(i):
	stack.append(i) def push(i):
	stack.append(i) push def pop(i):
	return stack.pop(i) def pop(i):
	return stack.pop(i) pop stack = [] [] stack op = ["+","-","*"] ["+","-","*"] op
line= input().split(" ")
op = ["+","-","*"]

stack = []

def push(i):
	stack.append(i)

def pop(i):
	return stack.pop(i)

for i in line:
	if i not in op:
		push(int(i))
	else:
		if i == "+":
			push(pop(-1) + pop(-1))
		elif i == "-":
			push(pop(-2) - pop(-1))
		elif i == "*":
			push(pop(-1) * pop(-1))

print(*stack)

