using System; class Program { static void Main() { char[] cs = Console.ReadLine().ToCharArray(); int len = cs.Length; int ans = -(int)Math.Pow(10, 11); for (int cut = 0; cut < len; cut++) { int score = 0, vol = 0, digit = 0; for (int i = len - 1; 0 <= i; i--) { char c = cs[(cut + i) % len]; bool p = c == '+', m = c == '-'; bool pm = p || m; if ((i == len - 1 || i == 0) && pm) goto exit; if (pm) { if (p) score += vol; else score -= vol; vol = 0; digit = 0; } else { vol += (c - 48) * (int)Math.Pow(10, digit); digit++; } if (i == 0) score += vol; } if (ans < score) ans = score; exit:; } Console.WriteLine(ans); } }