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

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

print(stack[-1]) 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 stack = [] stack [] for c in input().split():
	if c in ope:
		stack.append(ope[c](stack.pop(), stack.pop()))
	else:
		stack.append(int(c)) c input().split() ().split () input split if c in ope:
		stack.append(ope[c](stack.pop(), stack.pop()))
	else:
		stack.append(int(c)) c in ope c ope stack.append(ope[c](stack.pop(), stack.pop())) stack.append stack append ope[c](stack.pop(), stack.pop()) [c] ope c stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop stack.append(int(c)) stack.append stack append int(c) int c print(stack[-1]) print stack[-1] stack -1 stack = [] [] stack 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
ope = {"+": lambda a, b: b + a,
	   "-": lambda a, b: b - a,
	   "*": lambda a, b: b * a}
stack = []

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

print(stack[-1])