s = input() stc = [] stc2 = [] ope = [] for i in s: if i.isdigit() == True: stc.append(i) else: ope.append("".join(stc)) stc = [] stc2.append(i) else: ope.append("".join(stc)) stc = [] for j in range(len(stc2)): ope.append(stc2.pop(0)) for k in ope: x = 0 if k.isdigit() == True: stc.insert(0,k) elif k == "+": x = int(stc.pop()) * int(stc.pop()) stc.append(str(x)) elif k == "*": x = int(stc.pop()) + int(stc.pop()) stc.append(str(x)) else: print(stc.pop())