Joe and Bob are bus drivers, both working for the same company and driving the same route. Joe and Bob's bus route can be modeled as a line of bus stops, with passengers waiting to board at each stop for . Since each of their buses travels at very high speeds (very dangerous driving, that's for sure), the distance between stops can be considered to be negligible. Joe and Bob will each leave from the initial station (before stop ) and eventually arrive at the last station (past stop ). Whenever one of them arrives at a stop, they must allow each person waiting at that stop to board their bus, taking second for each passenger.

If both Joe and Bob arrive at a stop at the same time, Bob will pick up the passengers (because Joe is a meanie). Furthermore, only one driver can pick up passengers from a stop at a time: if the other driver reaches that stop, they simply go past.

Joe is competitive and wants to beat Bob to the last station by the greatest amount of time possible. Joe, being devious, has decided that if necessary he will stop for an arbitrary number of seconds between stops in order to allow Bob to pick up passengers at the next stop. Joe wishes to know the maximum time by which he can beat Bob; that is, the largest possible number of seconds between their arrivals at the last station.

#### Constraints

#### Input Specification

The first line of input will contain a single integer , the number of bus stops on the route. The second line of input will contain space separated integers, the number of passengers waiting at each bus stop.

#### Output Specification

Output on a single line the greatest number of seconds by which Joe can beat Bob, or if Bob will always arrive earlier than Joe.

#### Sample Input

```
9
5 3 9 6 1 3 8 1 3
```

#### Sample Output

`4`

## Comments