p = lambda x,y:x+y
m = lambda x,y:x-y
t = lambda x,y:x*y
ope = {'+':p, '-':m, '*':t}

data = [int(s) if s.isdigit() else s for s in input().split()]
while len(data) > 1:
	isope = [isinstance(d,str) for d in data]
	ope_idx = isope.index(True)
	xy = data[ope_idx-2:ope_idx]
	ans = ope[data[ope_idx]](*xy)
	data = data[:ope_idx-2] + [ans] + data[ope_idx+1:]

print(data[0]) p = lambda x,y:x+y p lambda x,y:x+y x+y x y x y m = lambda x,y:x-y m lambda x,y:x-y x-y x y x y t = lambda x,y:x*y t lambda x,y:x*y x*y x y x y ope = {'+':p, '-':m, '*':t} ope {'+':p, '-':m, '*':t} '+' '+' p '-' '-' m '*' '*' t int(s) if s.isdigit() else s for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) if s.isdigit() else s s.isdigit() s.isdigit s isdigit int(s) int s s data = [int(s) if s.isdigit() else s for s in input().split()] data [int(s) if s.isdigit() else s for s in input().split()] while len(data) > 1:
	isope = [isinstance(d,str) for d in data]
	ope_idx = isope.index(True)
	xy = data[ope_idx-2:ope_idx]
	ans = ope[data[ope_idx]](*xy)
	data = data[:ope_idx-2] + [ans] + data[ope_idx+1:] len(data) > 1 len(data) len data 1 isinstance(d,str) for d in data for d in data d data for d in data isinstance(d,str) isinstance d str isope = [isinstance(d,str) for d in data] isope [isinstance(d,str) for d in data] ope_idx = isope.index(True) ope_idx isope.index(True) isope.index isope index True xy = data[ope_idx-2:ope_idx] xy data[ope_idx-2:ope_idx] data ope_idx-2:ope_idx ope_idx-2 ope_idx 2 ope_idx ans = ope[data[ope_idx]](*xy) ans ope[data[ope_idx]](*xy) [data[ope_idx]] ope data[ope_idx] data ope_idx *xy xy data = data[:ope_idx-2] + [ans] + data[ope_idx+1:] data data[:ope_idx-2] + [ans] + data[ope_idx+1:] data[:ope_idx-2] + [ans] data[:ope_idx-2] data :ope_idx-2 ope_idx-2 ope_idx 2 [ans] ans data[ope_idx+1:] data ope_idx+1: ope_idx+1 ope_idx 1 print(data[0]) print data[0] data 0 p = lambda x,y:x+y lambda x,y:x+y p m = lambda x,y:x-y lambda x,y:x-y m ope = {'+':p, '-':m, '*':t} {'+':p, '-':m, '*':t} ope xy = data[ope_idx-2:ope_idx] data[ope_idx-2:ope_idx] xy isope = [isinstance(d,str) for d in data] [isinstance(d,str) for d in data] isope ans = ope[data[ope_idx]](*xy) ope[data[ope_idx]](*xy) ans data = [int(s) if s.isdigit() else s for s in input().split()] [int(s) if s.isdigit() else s for s in input().split()] data t = lambda x,y:x*y lambda x,y:x*y t ope_idx = isope.index(True) isope.index(True) ope_idx data = data[:ope_idx-2] + [ans] + data[ope_idx+1:] data[:ope_idx-2] + [ans] + data[ope_idx+1:] data
p = lambda x,y:x+y
m = lambda x,y:x-y
t = lambda x,y:x*y
ope = {'+':p, '-':m, '*':t}

data = [int(s) if s.isdigit() else s for s in input().split()]
while len(data) > 1:
	isope = [isinstance(d,str) for d in data]
	ope_idx = isope.index(True)
	xy = data[ope_idx-2:ope_idx]
	ans = ope[data[ope_idx]](*xy)
	data = data[:ope_idx-2] + [ans] + data[ope_idx+1:]

print(data[0])