if __name__ == '__main__':
	l = input().split()
	count = 0

	for i in range(len(l)):
		i -= count
		if l[i] == '+':
			l[i - 2] = str(int(l[i - 2])  + int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '-':
			l[i - 2] = str(int(l[i - 2])  - int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '*':
			l[i - 2] = str(int(l[i - 2])  * int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		else:
			continue
	if len(l) > 1:
		print("Error")
	else:
		print(l[0])
 if __name__ == '__main__':
	l = input().split()
	count = 0

	for i in range(len(l)):
		i -= count
		if l[i] == '+':
			l[i - 2] = str(int(l[i - 2])  + int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '-':
			l[i - 2] = str(int(l[i - 2])  - int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '*':
			l[i - 2] = str(int(l[i - 2])  * int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		else:
			continue
	if len(l) > 1:
		print("Error")
	else:
		print(l[0]) __name__ == '__main__' __name__ '__main__' l = input().split() l input().split() ().split () input split count = 0 count 0 for i in range(len(l)):
		i -= count
		if l[i] == '+':
			l[i - 2] = str(int(l[i - 2])  + int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '-':
			l[i - 2] = str(int(l[i - 2])  - int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '*':
			l[i - 2] = str(int(l[i - 2])  * int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		else:
			continue
	 i range(len(l)) range len(l) len l i -= count i count if l[i] == '+':
			l[i - 2] = str(int(l[i - 2])  + int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '-':
			l[i - 2] = str(int(l[i - 2])  - int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '*':
			l[i - 2] = str(int(l[i - 2])  * int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		else:
			continue
	 l[i] == '+' l[i] l i '+' l[i - 2] = str(int(l[i - 2])  + int(l[i - 1])) l[i - 2] l i - 2 i 2 str(int(l[i - 2])  + int(l[i - 1])) str int(l[i - 2])  + int(l[i - 1]) int(l[i - 2]) int l[i - 2] l i - 2 i 2 int(l[i - 1]) int l[i - 1] l i - 1 i 1 l.pop(i - 1) l.pop l pop i - 1 i 1 l.pop(i - 1) l.pop l pop i - 1 i 1 count += 2 count 2 elif l[i] == '-':
			l[i - 2] = str(int(l[i - 2])  - int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		 l[i] == '-' l[i] l i '-' l[i - 2] = str(int(l[i - 2])  - int(l[i - 1])) l[i - 2] l i - 2 i 2 str(int(l[i - 2])  - int(l[i - 1])) str int(l[i - 2])  - int(l[i - 1]) int(l[i - 2]) int l[i - 2] l i - 2 i 2 int(l[i - 1]) int l[i - 1] l i - 1 i 1 l.pop(i - 1) l.pop l pop i - 1 i 1 l.pop(i - 1) l.pop l pop i - 1 i 1 count += 2 count 2 elif l[i] == '*':
			l[i - 2] = str(int(l[i - 2])  * int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		 l[i] == '*' l[i] l i '*' l[i - 2] = str(int(l[i - 2])  * int(l[i - 1])) l[i - 2] l i - 2 i 2 str(int(l[i - 2])  * int(l[i - 1])) str int(l[i - 2])  * int(l[i - 1]) int(l[i - 2]) int l[i - 2] l i - 2 i 2 int(l[i - 1]) int l[i - 1] l i - 1 i 1 l.pop(i - 1) l.pop l pop i - 1 i 1 l.pop(i - 1) l.pop l pop i - 1 i 1 count += 2 count 2 continue if len(l) > 1:
		print("Error")
	else:
		print(l[0]) len(l) > 1 len(l) len l 1 print("Error") print "Error" print(l[0]) print l[0] l 0 i -= count count i count += 2 2 count count += 2 2 count count = 0 0 count l = input().split() input().split() l count += 2 2 count
if __name__ == '__main__':
	l = input().split()
	count = 0

	for i in range(len(l)):
		i -= count
		if l[i] == '+':
			l[i - 2] = str(int(l[i - 2])  + int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '-':
			l[i - 2] = str(int(l[i - 2])  - int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		elif l[i] == '*':
			l[i - 2] = str(int(l[i - 2])  * int(l[i - 1]))
			l.pop(i - 1)
			l.pop(i - 1)
			count += 2

		else:
			continue
	if len(l) > 1:
		print("Error")
	else:
		print(l[0])

