S = input() T = S+S ans = -10**20 for i in range(len(S)): U = T[i:len(S)+i] if not(U[0]=='+' or U[0]=='-' or U[-1]=='+' or U[-1]=='-'): exec("a = " + U) ans = max(a,ans) print(ans)