using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Test { static class Program { static void Main(string[] args) { Scanner cin = new Scanner(); string expr = cin.Next(); int ans = 0; for (int i = 0; i < expr.Length; i++) { string left = expr.Substring(0, i); string right = expr.Substring(i); string temp = right + left; int val = Eval(temp); ans = Math.Max(ans, Eval(temp)); } Console.WriteLine(ans); } static int Eval(string expr) { if (expr[0] == '+' || expr[expr.Length - 1] == '+') return 0; if (expr[0] == '-' || expr[expr.Length - 1] == '-') return 0; List op = new List(); foreach (var item in expr) { if (item == '+' || item == '-') { op.Add(item); } } string[] vals = expr.Split('+', '-'); int res = int.Parse(vals[0]); for (int i = 0; i < vals.Length - 1; i++) { if (op[i] == '+') { res += int.Parse(vals[i + 1]); } else { res -= int.Parse(vals[i + 1]); } } return res; } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return s[i++]; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } } }