Mizuyokan is a Japanese sweet made by pouring a paste of red beans into a mould and setting it with agar. JOI has one bar of mizuyokan shaped like a long rectangular block. He plans to eat it as today's snack.
The bar carries N−1 score lines that run across it. The whole bar has length L1+L2+⋯+LN, and the i-th score line (1≤i≤N−1) sits at distance L1+L2+⋯+Li from the left end.
The bar is too large to eat whole, so JOI picks at least one of the score lines and cuts the bar along every picked line, splitting it into several pieces. Pieces of uneven size look bad, so he wants the difference between the longest piece and the shortest piece to be as small as possible.
Find the smallest possible difference between the length of the longest piece and the length of the shortest piece.