N = int(input())
W = list(map(int, input().split()))
ans = 10**9
for i in range(N - 1):
    s1 = W[:i + 1]
    s2 = W[i + 1:]
    diff = abs(sum(s1) - sum(s2))
    if diff < ans:
        ans = diff
print(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 ans = 10**9 ans 10**9 10 9 for i in range(N - 1):
    s1 = W[:i + 1]
    s2 = W[i + 1:]
    diff = abs(sum(s1) - sum(s2))
    if diff < ans:
        ans = diff i range(N - 1) range N - 1 N 1 s1 = W[:i + 1] s1 W[:i + 1] W :i + 1 i + 1 i 1 s2 = W[i + 1:] s2 W[i + 1:] W i + 1: i + 1 i 1 diff = abs(sum(s1) - sum(s2)) diff abs(sum(s1) - sum(s2)) abs sum(s1) - sum(s2) sum(s1) sum s1 sum(s2) sum s2 if diff < ans:
        ans = diff diff < ans diff ans ans = diff ans diff print(ans) print ans ans = 10**9 10**9 ans s1 = W[:i + 1] W[:i + 1] s1 diff = abs(sum(s1) - sum(s2)) abs(sum(s1) - sum(s2)) diff s2 = W[i + 1:] W[i + 1:] s2 ans = diff diff ans N = int(input()) int(input()) N W = list(map(int, input().split())) list(map(int, input().split())) W
N = int(input())
W = list(map(int, input().split()))
ans = 10**9
for i in range(N - 1):
    s1 = W[:i + 1]
    s2 = W[i + 1:]
    diff = abs(sum(s1) - sum(s2))
    if diff < ans:
        ans = diff
print(ans)
