using System; using System.Collections.Generic; using System.Linq; class P { static int Search(int i) { if (dp[i] > 0) { return dp[i]; } int res = 0; if(i >= n) { res = 0; } else { res = Math.Max(Search(i + 2), Search(i + 3)) + V[i]; } return dp[i] = res; } static int n; static int[] V = new int[1001]; static int[] dp = new int[1001]; static void Main(string[]_) { n = int.Parse(Console.ReadLine()); _=Console.ReadLine().Split(' '); for (int i = 0; i < n; i++) { V[i] = int.Parse(_[i]); } Console.WriteLine(Math.Max(Search(0),Search(1))); } }