n = int(input())
w = list(map(int,input().split()))
w2 = []
tmp = []
for i in range(n - 1):
    w2.append(w[0])
    w.pop(0)
    tmp.append(abs(sum(w) - sum(w2)))
print(min(tmp)) 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 w2 = [] w2 [] tmp = [] tmp [] for i in range(n - 1):
    w2.append(w[0])
    w.pop(0)
    tmp.append(abs(sum(w) - sum(w2))) i range(n - 1) range n - 1 n 1 w2.append(w[0]) w2.append w2 append w[0] w 0 w.pop(0) w.pop w pop 0 tmp.append(abs(sum(w) - sum(w2))) tmp.append tmp append abs(sum(w) - sum(w2)) abs sum(w) - sum(w2) sum(w) sum w sum(w2) sum w2 print(min(tmp)) print min(tmp) min tmp w2 = [] [] w2 n = int(input()) int(input()) n w = list(map(int,input().split())) list(map(int,input().split())) w tmp = [] [] tmp
n = int(input())
w = list(map(int,input().split()))
w2 = []
tmp = []
for i in range(n - 1):
    w2.append(w[0])
    w.pop(0)
    tmp.append(abs(sum(w) - sum(w2)))
print(min(tmp))
