N = int(input())

weights = list(map(int,input().split()))

ans = 100*1000

for i in range(N):
    f = sum(weights[:i])
    s = sum(weights[i:])
    dif = abs(f-s)
    
    if dif < ans:
        ans = dif
        
print(ans) N = int(input()) N int(input()) int input() input weights = list(map(int,input().split())) weights list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans = 100*1000 ans 100*1000 100 1000 for i in range(N):
    f = sum(weights[:i])
    s = sum(weights[i:])
    dif = abs(f-s)
    
    if dif < ans:
        ans = dif
         i range(N) range N f = sum(weights[:i]) f sum(weights[:i]) sum weights[:i] weights :i i s = sum(weights[i:]) s sum(weights[i:]) sum weights[i:] weights i: i dif = abs(f-s) dif abs(f-s) abs f-s f s if dif < ans:
        ans = dif
         dif < ans dif ans ans = dif ans dif print(ans) print ans weights = list(map(int,input().split())) list(map(int,input().split())) weights ans = dif dif ans ans = 100*1000 100*1000 ans f = sum(weights[:i]) sum(weights[:i]) f dif = abs(f-s) abs(f-s) dif s = sum(weights[i:]) sum(weights[i:]) s N = int(input()) int(input()) N
N = int(input())

weights = list(map(int,input().split()))

ans = 100*1000

for i in range(N):
    f = sum(weights[:i])
    s = sum(weights[i:])
    dif = abs(f-s)
    
    if dif < ans:
        ans = dif
        
print(ans)