n = int(input())
w = list(map(int,input().split()))
ans = 10 **10
for i in range(n-1):
    #print(sum(w[:i+1]))
    tmp = abs(sum(w) - 2 * sum(w[:i+1]))
    ans = min(ans,tmp)
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 **10 ans 10 **10 10 10 for i in range(n-1):
    #print(sum(w[:i+1]))
    tmp = abs(sum(w) - 2 * sum(w[:i+1]))
    ans = min(ans,tmp) i range(n-1) range n-1 n 1 tmp = abs(sum(w) - 2 * sum(w[:i+1])) tmp abs(sum(w) - 2 * sum(w[:i+1])) abs sum(w) - 2 * sum(w[:i+1]) sum(w) sum w 2 * sum(w[:i+1]) 2 sum(w[:i+1]) sum w[:i+1] w :i+1 i+1 i 1 ans = min(ans,tmp) ans min(ans,tmp) min ans tmp print(ans) print ans ans = 10 **10 10 **10 ans tmp = abs(sum(w) - 2 * sum(w[:i+1])) abs(sum(w) - 2 * sum(w[:i+1])) tmp n = int(input()) int(input()) n ans = min(ans,tmp) min(ans,tmp) ans w = list(map(int,input().split())) list(map(int,input().split())) w
n = int(input())
w = list(map(int,input().split()))
ans = 10 **10
for i in range(n-1):
    #print(sum(w[:i+1]))
    tmp = abs(sum(w) - 2 * sum(w[:i+1]))
    ans = min(ans,tmp)
print(ans)
