N=int(input())
S=list(map(int, input().split()))
A=[]
for i in range(1,N):
  A.append(abs(sum(S[:i])-sum(S[i:])))
print(min(A) if not A==[] else abs(S[0]-S[1])) N=int(input()) N int(input()) int input() input S=list(map(int, input().split())) S list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A=[] A [] for i in range(1,N):
  A.append(abs(sum(S[:i])-sum(S[i:]))) i range(1,N) range 1 N A.append(abs(sum(S[:i])-sum(S[i:]))) A.append A append abs(sum(S[:i])-sum(S[i:])) abs sum(S[:i])-sum(S[i:]) sum(S[:i]) sum S[:i] S :i i sum(S[i:]) sum S[i:] S i: i print(min(A) if not A==[] else abs(S[0]-S[1])) print min(A) if not A==[] else abs(S[0]-S[1]) not A==[] A==[] A [] min(A) min A abs(S[0]-S[1]) abs S[0]-S[1] S[0] S 0 S[1] S 1 A=[] [] A N=int(input()) int(input()) N S=list(map(int, input().split())) list(map(int, input().split())) S
N=int(input())
S=list(map(int, input().split()))
A=[]
for i in range(1,N):
  A.append(abs(sum(S[:i])-sum(S[i:])))
print(min(A) if not A==[] else abs(S[0]-S[1]))