n = int(input())
w = list(map(int,input().split()))

wmin = []

w_sum = [w[0]]
for i in range(1,n):
    w_sum.append(w_sum[i-1] + w[i])

for i in range(n-1):
    wmin.append(abs(w_sum[n-1]-2*w_sum[i]))

print(min(wmin)) 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 wmin = [] wmin [] w_sum = [w[0]] w_sum [w[0]] w[0] w 0 for i in range(1,n):
    w_sum.append(w_sum[i-1] + w[i]) i range(1,n) range 1 n w_sum.append(w_sum[i-1] + w[i]) w_sum.append w_sum append w_sum[i-1] + w[i] w_sum[i-1] w_sum i-1 i 1 w[i] w i for i in range(n-1):
    wmin.append(abs(w_sum[n-1]-2*w_sum[i])) i range(n-1) range n-1 n 1 wmin.append(abs(w_sum[n-1]-2*w_sum[i])) wmin.append wmin append abs(w_sum[n-1]-2*w_sum[i]) abs w_sum[n-1]-2*w_sum[i] w_sum[n-1] w_sum n-1 n 1 2*w_sum[i] 2 w_sum[i] w_sum i print(min(wmin)) print min(wmin) min wmin w_sum = [w[0]] [w[0]] w_sum n = int(input()) int(input()) n w = list(map(int,input().split())) list(map(int,input().split())) w wmin = [] [] wmin
n = int(input())
w = list(map(int,input().split()))

wmin = []

w_sum = [w[0]]
for i in range(1,n):
    w_sum.append(w_sum[i-1] + w[i])

for i in range(n-1):
    wmin.append(abs(w_sum[n-1]-2*w_sum[i]))

print(min(wmin))
