s=input() n=len(s) s=s+s a=-10**10 for i in range(n): if (s[i] not in "+-") and (s[i+n-1] not in "+-"): q=[""] for c in s[i:i+n]: if c in "+-": q+=[""] if c!="+": q[-1]+=[c] a=max(a,sum(int(v) for v in q)) print(a)