from re import findall def calc(s): ts = findall('\+|\-|\d+', s) if ts[0] == '+' or ts[0] == '-': return None acc = int(ts[0]) ts = ts[1:] while ts: if len(ts) == 1: return None if ts[0] == '+': acc += int(ts[1]) else: acc -= int(ts[1]) ts = ts[2:] return acc S = raw_input() ss = [(S+S)[i:i+len(S)] for i in range(len(S))] print(max(calc(s) for s in ss))