N = int(input())
W = list(map(int, input().split()))
add=0
ans=list()
for i in W:
    add+=i
    ans.append(abs(add-(sum(W)-add)))
print(min(ans)) N = int(input()) N int(input()) int input() input W = list(map(int, input().split())) W list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split add=0 add 0 ans=list() ans list() list for i in W:
    add+=i
    ans.append(abs(add-(sum(W)-add))) i W add+=i add i ans.append(abs(add-(sum(W)-add))) ans.append ans append abs(add-(sum(W)-add)) abs add-(sum(W)-add) add sum(W)-add sum(W) sum W add print(min(ans)) print min(ans) min ans ans=list() list() ans N = int(input()) int(input()) N add=0 0 add add+=i i add W = list(map(int, input().split())) list(map(int, input().split())) W
N = int(input())
W = list(map(int, input().split()))
add=0
ans=list()
for i in W:
    add+=i
    ans.append(abs(add-(sum(W)-add)))
print(min(ans))