Game#1660

Game

1 second
128 megabytes
Easy

A sheet of paper contains (2 \le n \le 100, is even) positive integers. Each number does not exceed . Two players are playing a game. On each move, a player can cross out either the leftmost or rightmost number. The crossed-out number is added to the player's score.

Print the maximum possible total points the first player can get, assuming the opponent also plays optimally.

Input

The first line contains one integer (2 \le n \le 100, is even).Each of the next lines contains a positive integer not exceeding .

Output

Print the maximum total points the first player can get if the second player plays optimally.

Examples

Example 1

Loading
Loading