# Playing a game of removing numbers

Letβs play a game. You are given n positive integers
(n is even). On each step, you are allowed to remove a number from the beginning or the very end of the sequence and keep it to yourself. I (the computer) will remove the largest among the first and the last elements in the sequence. In case those are equal, Iβll remove the first one. We will take turns until there are no items left on the list.
If you are the one starting the game, what would be the maximum sum of numbers you can collect?

#### Input

The first line of the input contains a single integer n (1 β€ n β€ 1000).
The next line contains n space-separated integers
(1 β€
β€
).

#### Output

The program should print the maximum sum you can collect.

#### Examples

 Input Output 4 3 2 10 4 13

#### Explanation

1. You take the first 3 β 2 10 4
1. The computer takes the 4 β 2 10
1. You take the 10 β 2
1. The computer takes the 2 β Youβve collected 3 + 10 = 13
Β

#### Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB