expression = input().split()
stack = []
for i in range(len(expression)):
	if expression[i] == '+':
		a = stack.pop()
		b = stack.pop()
		stack.append(a+b)
	elif expression[i] == '-':
		a = stack.pop()
		b = stack.pop()
		stack.append(b-a)
	elif expression[i] == '*':
		a = stack.pop()
		b = stack.pop()
		stack.append(a*b)
	else:
		stack.append(int(expression[i]))
print(str(stack.pop())) expression = input().split() expression input().split() ().split () input split stack = [] stack [] for i in range(len(expression)):
	if expression[i] == '+':
		a = stack.pop()
		b = stack.pop()
		stack.append(a+b)
	elif expression[i] == '-':
		a = stack.pop()
		b = stack.pop()
		stack.append(b-a)
	elif expression[i] == '*':
		a = stack.pop()
		b = stack.pop()
		stack.append(a*b)
	else:
		stack.append(int(expression[i])) i range(len(expression)) range len(expression) len expression if expression[i] == '+':
		a = stack.pop()
		b = stack.pop()
		stack.append(a+b)
	elif expression[i] == '-':
		a = stack.pop()
		b = stack.pop()
		stack.append(b-a)
	elif expression[i] == '*':
		a = stack.pop()
		b = stack.pop()
		stack.append(a*b)
	else:
		stack.append(int(expression[i])) expression[i] == '+' expression[i] expression i '+' a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop stack.append(a+b) stack.append stack append a+b a b elif expression[i] == '-':
		a = stack.pop()
		b = stack.pop()
		stack.append(b-a)
	 expression[i] == '-' expression[i] expression i '-' a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop stack.append(b-a) stack.append stack append b-a b a elif expression[i] == '*':
		a = stack.pop()
		b = stack.pop()
		stack.append(a*b)
	 expression[i] == '*' expression[i] expression i '*' a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop stack.append(a*b) stack.append stack append a*b a b stack.append(int(expression[i])) stack.append stack append int(expression[i]) int expression[i] expression i print(str(stack.pop())) print str(stack.pop()) str stack.pop() stack.pop stack pop b = stack.pop() stack.pop() b b = stack.pop() stack.pop() b b = stack.pop() stack.pop() b a = stack.pop() stack.pop() a stack = [] [] stack a = stack.pop() stack.pop() a expression = input().split() input().split() expression a = stack.pop() stack.pop() a
expression = input().split()
stack = []
for i in range(len(expression)):
	if expression[i] == '+':
		a = stack.pop()
		b = stack.pop()
		stack.append(a+b)
	elif expression[i] == '-':
		a = stack.pop()
		b = stack.pop()
		stack.append(b-a)
	elif expression[i] == '*':
		a = stack.pop()
		b = stack.pop()
		stack.append(a*b)
	else:
		stack.append(int(expression[i]))
print(str(stack.pop()))
