using System.Linq; using System; public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); string[] line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, long.Parse); var res = a[0]; for (int i = 1; i < n; i++) { var t = new long[4]; t[0] = res + a[i]; t[1] = res * a[i]; t[2] = res - a[i]; if (a[i] != 0) t[3] = res / a[i]; else a[i] = int.MinValue; res = t.Max(); } Console.WriteLine(res); } }