using System; using System.Linq; namespace No193{ public class Program{ public static void Main(string[] args){ var S = Console.ReadLine(); Func calc = str =>{ var asp = str.Split('+'); return asp.Sum(s => { var ssp = s.Split('-'); return -ssp.Sum(int.Parse) + int.Parse(ssp[0]) * 2; }); }; var max = int.MinValue; for(var i = 0; i < S.Length; i++){ if(S[0] != '+' && S[0] != '-' && S[S.Length - 1] != '+' && S[S.Length - 1] != '-'){ max = Math.Max(max, calc(S)); } S = S.Remove(0, 1) + S[0]; } Console.WriteLine(max); } } }