using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Magatro { static void Main() { int N = int.Parse(Console.ReadLine()); int[] V = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int[] counter = new int[N]; counter[0] = V[0]; counter[1] = V[1]; for(int i = 0; i < N; i++) { for(int j = i + 2; j < N; j++) { counter[j] = Math.Max(counter[j], counter[i] + V[j]); } } Console.WriteLine(counter.Max()); } }