N = int(input())
W = list(map(int, input().split()))

S1 = 0
S2 = sum(W)
min_diff = 100000
for i in range(1, N):
    S1 += W[i-1]
    S2 -= W[i-1]
    diff = abs(S2-S1)
    min_diff = min(diff, min_diff)
print(min_diff) 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 S1 = 0 S1 0 S2 = sum(W) S2 sum(W) sum W min_diff = 100000 min_diff 100000 for i in range(1, N):
    S1 += W[i-1]
    S2 -= W[i-1]
    diff = abs(S2-S1)
    min_diff = min(diff, min_diff) i range(1, N) range 1 N S1 += W[i-1] S1 W[i-1] W i-1 i 1 S2 -= W[i-1] S2 W[i-1] W i-1 i 1 diff = abs(S2-S1) diff abs(S2-S1) abs S2-S1 S2 S1 min_diff = min(diff, min_diff) min_diff min(diff, min_diff) min diff min_diff print(min_diff) print min_diff N = int(input()) int(input()) N S1 = 0 0 S1 W = list(map(int, input().split())) list(map(int, input().split())) W S2 = sum(W) sum(W) S2 diff = abs(S2-S1) abs(S2-S1) diff S1 += W[i-1] W[i-1] S1 S2 -= W[i-1] W[i-1] S2 min_diff = min(diff, min_diff) min(diff, min_diff) min_diff min_diff = 100000 100000 min_diff
N = int(input())
W = list(map(int, input().split()))

S1 = 0
S2 = sum(W)
min_diff = 100000
for i in range(1, N):
    S1 += W[i-1]
    S2 -= W[i-1]
    diff = abs(S2-S1)
    min_diff = min(diff, min_diff)
print(min_diff)
