Azora the corgi loves music but cannot catch the rhythm well, especially when counting beats! After hard research on music theory, Azora found a hidden theorem: There won't be a note crossing the boundary between the beats for modern songs (or for most barking sessions for that matter).
To simplify the problem, we assume that a modern song consists of several sequential notes whose lengths are $$$l_1,l_2,\cdots,l_n$$$ milliseconds. The notes will be played one by one, which means the song will start playing the first note at time $$$0$$$, and the second note at the beginning of the $$$l_1+1$$$ milliseconds, and the third note at the beginning of the $$$l_1+l_2+1$$$ milliseconds, and so on.
If the length of the beat is $$$L$$$ milliseconds, then there should not exist any note that is playing but not starting to play at the beginning of the $$$kL$$$ milliseconds, for any non-negative integer $$$k$$$. Formally, there should not exist any note $$$i$$$ such that $$$\sum_{j=1}^{i-1} l_j \lt kL$$$ but $$$\sum_{j=1}^il_j \gt kL$$$ for any non-negative integer $$$k$$$.
Now Azora has received a new song from her humans, and she wants to practice counting beats before she barks the song back to them. To challenge herself, Azora wants to find the smallest possible length of a beat, such that it satisfies the theorem. Can you help her?
The first line contains a single integer $$$n~(1\le n\le 2\times 10^5)$$$, representing the number of notes in the song.
The second line contains $$$n$$$ integers $$$l_1,l_2,\cdots,l_n~(1\le l_i\le 10^9)$$$, representing the length of each note.
Output a single integer, representing the minimum possible length of a beat.
51 2 3 6 5
6
51 2 3 4 5
10
| Название |
|---|


