switch = {
"+":(lambda v1,v2: v1+v2),
"*":(lambda v1,v2: v1*v2),
"-":(lambda v1,v2: v1-v2),
"/":(lambda v1,v2: v1//v2) }
def solve(inp):
tmp = []
inp = inp.split()
for _ in inp :
try :
tmp.append(int(_))
except :
tmp.append( switch[_](tmp.pop(-2),tmp.pop()) )
return tmp[-1]
print(solve(input()))