# Optimal Strategy For A Game

easy

1. You are given N coins as an integer array, size of array is even 2. You are playing against an opponent where both of you get turns alternatingly 3. In each turn a player removes either last of the first element from the array permanently and adds that coin value to his pile 4. You need to find the maximum amount of money you can win if you go first 5. Input and output is handled for you 6. It is a functional problem ,please do not modify main()

## Constraints

2 <= N <= 100 1<= A[i]<=10^6

## Format

### Input

Input is handled for you

### Output

Output is handled for you

## Example

Sample Input

4
8 15 3 7

### Sample Output

22