# coding:utf-8
# 演算を辞書に押し込む
ops = {	"+": lambda a, b: b + a,
		"-": lambda a, b: b - a,
		"*": lambda a, b: b * a,
		"/": lambda a, b: b / a}

stack = []

for s in raw_input().split():
	if s in ops:
		stack.append(ops[s](stack.pop(), stack.pop()))
	else:
		stack.append(int(s))
print stack[-1]		 ops = {	"+": lambda a, b: b + a,
		"-": lambda a, b: b - a,
		"*": lambda a, b: b * a,
		"/": lambda a, b: b / a} ops {	"+": 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 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 "/" "/" lambda a, b: b / a b / a b a a b stack = [] stack [] for s in raw_input().split():
	if s in ops:
		stack.append(ops[s](stack.pop(), stack.pop()))
	else:
		stack.append(int(s)) s raw_input().split() ().split () raw_input split if s in ops:
		stack.append(ops[s](stack.pop(), stack.pop()))
	else:
		stack.append(int(s)) s in ops s ops stack.append(ops[s](stack.pop(), stack.pop())) stack.append stack append ops[s](stack.pop(), stack.pop()) [s] ops s stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop stack.append(int(s)) stack.append stack append int(s) int s print stack[-1] stack -1 ops = {	"+": 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,
		"*": lambda a, b: b * a,
		"/": lambda a, b: b / a} ops stack = [] [] stack
# coding:utf-8
# 演算を辞書に押し込む
ops = {	"+": lambda a, b: b + a,
		"-": lambda a, b: b - a,
		"*": lambda a, b: b * a,
		"/": lambda a, b: b / a}

stack = []

for s in raw_input().split():
	if s in ops:
		stack.append(ops[s](stack.pop(), stack.pop()))
	else:
		stack.append(int(s))
print stack[-1]		