/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int[] a = {1, 2, 3, 10, 11, 12};
		int n = a.length;
		int k = 3;
		
		int[][] dp = new int[n][n];
		dp[0][0] = 0;
		dp[0][1] = a[1];
		
		dp[1][0] = 0;
		dp[1][1] = Math.max(a[0], a[1]);
		
		for(int i = 2; i < n; i++){
		dp[1][i] = Integer.MIN_VALUE;
		}
		
		for(int i = 2; i < n; i++){
			dp[i][0] = 0;
			for(int j = 1; j <= k; j++){
				dp[i][j] = Math.max(a[i] + dp[i-2][j-1], dp[i-1][j]);
			}
		}
		
		System.out.print(dp[n-1][k]);
	}
}