Given is an integer sequence A_1, ..., A_N of length N.

We will choose exactly \left\lfloor \frac{N}{2} \right\rfloor elements from this sequence so that no two adjacent elements are chosen.

Find the maximum possible sum of the chosen elements.

Here \lfloor x \rfloor denotes the greatest integer not greater than x.

Constraints

* 2 \leq N \leq 2\times 10^5
* |A_i|\leq 10^9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
A_1 ... A_N


Output

Print the maximum possible sum of the chosen elements.

Examples

Input

6
1 2 3 4 5 6


Output

12


Input

5
-1000 -100 -10 0 10


Output

0


Input

10
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000


Output

5000000000


Input

27
18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49


Output

295
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		long[] a = new long[n];
		
		long[] sumo = new long[n];
		long[] sumx = new long[n];
		//assume n is odd
		long curso = 0; long cursx = 0;
		for(int i = 0; i < n; i++)
		{
			a[i] = sc.nextLong();
			if(i%2 == 0)
			{
				curso += a[i];
			}
			else
			{
				cursx += a[i];
			}
			sumo[i] = curso;
			sumx[i] = cursx;
		}
		//start with o
		if(n==2)
		{
			System.out.println(Math.max(a[0], a[1]));
			return;
		}
		
		if(n%2!=0)
		{
			//state 0 means start with o
			long shiftxscore = 0;
			long shiftxindex = 0;
			
			long max = -999999999999999999l;
			for(int i = n-1; i >= 0; i--)
			{
				int state = i%2==0?0:1;
				long con = 0;
				
				if(state == 1)
				{
					shiftxscore += a[i]; //update if we shift from x at old best spot
				}
				
				if(state == 0)
				{ //currently o, shift to x here? (then probably shift back at best spot)
					long sofar = 0;
					if(i>0)sofar=sumo[i-1];
					
					//rest
					long noshiftback = cursx; //rest would be all of x, except before this
					if(i>0)noshiftback-=sumx[i-1];
					//if we shift back, then we would gain shiftxscore
					long consi = sofar + Math.max(noshiftback, shiftxscore);
					
//					System.out.println(i + " consider " + consi);
					max = Math.max(max, consi);
				}
				else
				{ //currently x. should we shift from x here instead?
					con=curso; //o from here on
					if(i>0)con-=sumo[i-1];
					if(con > shiftxscore)
					{
						shiftxscore = con;
						shiftxindex = i;
					}
//					System.out.println(i + " considerx " + con);
				}
//				System.out.println(i + ": " + shiftxscore);
			}
			System.out.println(max);
		}
		else
		{ //even case: shift once
			long max = -999999999999999999l;
			for(int i = 0; i < n; i++)
			{
				if(i%2==0)
				{
					long con = 0;
					if(i>0)con+=sumo[i-1];
					long contem = con;
					con+=cursx;
					if(i>0)con-=sumx[i-1];
//					if(max<con)System.out.println(i + ": " + contem + " " + cursx);
					max = Math.max(max, con);
				}
			}
			max = Math.max(max, curso);
			max = Math.max(max, cursx);
			System.out.println(max);
		}
	}

}
