In this single player coin game, N coins are arranged in a row and assigned values v1, v2 …. vN from left to right.

In each turn, a player selects a coin x other than the very first coin and the very last coin from the row, removes it from the row permanently, and earns points equal to value [x-1] * value[x+1]. Then decrease N by 1 and relabel the coins 1 through N from left to right.

Determine the maximum possible amount of points that player can win.

**Input**

First line of the input contains an integer N denoting the number of coins.

Second line of the input contains N single space separated integers denoting the value of the coins.

**Output**

Print the largest possible total amount of points that can be achieved.

**Constraints:** 3 <= N <= 100

Value of each coin will be a positive integer less than or equal to 1000.

**Note:** We have only 2 choices:

Remove the coin with value "7" first, and "2" next. The total points are 4*2 + 4*5= 28.

Remove the coin with value "2" first, and "7" next. The total points are 7*5 + 4*5= 55.

Hence, the answer is 55.

**Sample testcases**

**Input**

4

4 7 2 5

**Output**

55

Thanks in advance.