def calc(s): s = "#" + s t = "" a = [] op = [] for i in range(1, len(s)): # 数字の直後の符号のみop if s[i] in ('+', '-') and s[i - 1].isdigit(): op.append(s[i]) a.append(t) t = "" else: t += s[i] if t != "": a.append(t) a = list(map(int, a)) ans = a[0] for i in range(len(op)): if op[i] == '+': ans += a[i + 1] else: ans -= a[i + 1] return ans s = input() N = len(s) s += s ans = -10**15 for i in range(N): if s[i].isdigit() and s[i+N-1].isdigit(): ans = max(ans, calc(s[i:i+N])) print(ans)