using System; using System.Collections.Generic; using System.Linq; namespace yuki0045 { class Program { static internal List V; static internal int FindMax(int k) { return V[ k - 1 ] + ( V.Count() - k <= 1 ? 0 : ( V.Count() - k == 2 ) ? V[ k + 1 ] : Math.Max( FindMax( k + 2 ), FindMax( k + 3 ) ) ); } static internal int TakeMax(System.IO.TextReader reader) { V = reader.ReadLine().Split().ToList().ConvertAll( int.Parse ); return V.Count == 1 ? V[ 0 ] : Math.Max( FindMax( 1 ), FindMax( 2 ) ); } static void Main(string[] args) { Console.ReadLine(); Console.WriteLine( TakeMax( Console.In ) ); } } }