###### Description

There is a shop selling cookies in baskets. The shop has `N`

numbered baskets numbered from 1 to `N`

in order.

Dave is trying to buy some cookies for his two sons. He is going to purchase cookies so that the baskets' for the first son is 1 to `m`

, for the second the number should be `m+1`

to `r`

.(1 <= `l`

<= `m`

, `m+1`

<= `r`

<= `N`

) However, the number of cookies which the two sons will receive must be the same. That is, if `A[i]`

is the number of cookies contained in the basket `i`

,`A[l]+..+A[m] = A[m+1]+..+A[r]`

should be satisfied.

Given an array cookie that contains the number of cookies in order, complete the solution function that returns the maximum number of cookies that can be given to a son if he buys cookies that meet the conditions. However, if cookies cannot be purchased according to the conditions, return 0.

##### Constraints

- The length of the cookie between 1 and 2000, inclusive.
- Each element of the cookie is a natural number between 1 and 500 inclusive.

##### Examples

cookie | result |
---|---|

[1,1,2,3] | 3 |

[1,2,4,5] | 0 |

Example #1

If he buys basket number 2 and 3 for the first son and number 4 for the second son, they will receive 3 cookies each. It is the maximum number of cookies which can be given to each son.

Example #2

There is no way to buy cookies to meet the given condition.