Someone found a long tape at home and wrote a row of integers on it. Now they want to cut the tape at a single point, splitting it into two pieces, so that the difference between the sum of the numbers on one piece and the sum on the other piece is as close to 0 as possible. Each piece must contain at least one number. Find the minimum possible absolute value of that difference.
The first line contains the count of numbers on the tape, n (2≤n≤106). The second line contains the n integers ai (−103≤ai≤103) written on the tape, in order.
Print, on a single line, the minimum absolute value of the difference between the sums of the two pieces.
For example, if the sequence is 1,2,3,4,5,6, cutting after the fourth number splits it into 1,2,3,4 and 5,6, and the absolute value of the difference of the two sums is ∣(1+2+3+4)−(5+6)∣=1.