a = list(input().split())
number = []
while (a != []):
op_or_int = a.pop(0)
try: # int
eval(op_or_int)
number.append(op_or_int)
except: # op
count = number.pop()
count1 = number.pop()
number.append(str(eval(count1+op_or_int+count)))
print(format(float(number[0]),".0f"))