def push(x):
	global stack

	stack.append(x)

def pop():
	global stack

	ret = stack.pop()
	return ret

ope = {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a}

if __name__ == '__main__':
	stack = []

	for c in input().split():
		if c in ope:
			push(ope[c](pop(), pop()))
		else:
			push(int(c))

	print(" ".join(map(str, stack))) def push(x):
	global stack

	stack.append(x) push global stack stack.append(x) stack.append stack append x x x def pop():
	global stack

	ret = stack.pop()
	return ret pop global stack ret = stack.pop() ret stack.pop() stack.pop stack pop return ret ret ope = {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a} ope {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a} "+" "+" lambda a, b: b + a b + a b a a b "-" "-" lambda a, b: b - a b - a b a a b "*" "*" lambda a, b: b * a b * a b a a b if __name__ == '__main__':
	stack = []

	for c in input().split():
		if c in ope:
			push(ope[c](pop(), pop()))
		else:
			push(int(c))

	print(" ".join(map(str, stack))) __name__ == '__main__' __name__ '__main__' stack = [] stack [] for c in input().split():
		if c in ope:
			push(ope[c](pop(), pop()))
		else:
			push(int(c))

	 c input().split() ().split () input split if c in ope:
			push(ope[c](pop(), pop()))
		else:
			push(int(c))

	 c in ope c ope push(ope[c](pop(), pop())) push ope[c](pop(), pop()) [c] ope c pop() pop pop() pop push(int(c)) push int(c) int c print(" ".join(map(str, stack))) print " ".join(map(str, stack)) " ".join " " join map(str, stack) map str stack stack = [] [] stack def push(x):
	global stack

	stack.append(x) def push(x):
	global stack

	stack.append(x) push ope = {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a} {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a} ope def pop():
	global stack

	ret = stack.pop()
	return ret def pop():
	global stack

	ret = stack.pop()
	return ret pop
def push(x):
	global stack

	stack.append(x)

def pop():
	global stack

	ret = stack.pop()
	return ret

ope = {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a}

if __name__ == '__main__':
	stack = []

	for c in input().split():
		if c in ope:
			push(ope[c](pop(), pop()))
		else:
			push(int(c))

	print(" ".join(map(str, stack)))