using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { var sol = new Solve(); sol.Exec(); } } class Solve { public void Exec() { var N = int.Parse(Console.ReadLine()); var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); var acumFoward = new List() { 0 }; var acumBack = new List() { 0 }; for (var i = 1; i < 2 * N; i+=2) { acumFoward.Add(acumFoward[acumFoward.Count - 1] + A[i - 1] - A[i]); acumBack.Add(acumBack[acumBack.Count - 1] + A[A.Length - 1 - i + 1] - A[A.Length - 1 - i]); } var ans = 0L; for (var i = 0; i <= N; i++) { ans = Math.Max(ans, acumFoward[i] + acumBack[N - i]); } Console.WriteLine(ans); } } public class Util { }