###### 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.