import re S = input() print( max( [ eval(s) for s in [re.sub(r"0+(\d+)", r"\1", t) for t in [S[i:] + S[:i] for i in range(len(S))]] if not re.match(r"^[^+-].*[^+-]$", s) is None ] ) )