N=int(input())
W=list(map(int,input().split()))
SUM=sum(W)
a=[]
b=[]
c=[]
for i in range (N):
    a.append(0)
for i in range (N):
    b.append(0)
for i in range (N):
    c.append(0)
for i in range(0,N):
    for j in range(0,i+1):
        a[i]=a[i]+W[j]
for i in range(0,N):
    b[i]=SUM-a[i]
for i in range(0,N):
    c[i]=abs(a[i]-b[i])
print(min(c)) 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 SUM=sum(W) SUM sum(W) sum W a=[] a [] b=[] b [] c=[] c [] for i in range (N):
    a.append(0) i range (N) range N a.append(0) a.append a append 0 for i in range (N):
    b.append(0) i range (N) range N b.append(0) b.append b append 0 for i in range (N):
    c.append(0) i range (N) range N c.append(0) c.append c append 0 for i in range(0,N):
    for j in range(0,i+1):
        a[i]=a[i]+W[j] i range(0,N) range 0 N for j in range(0,i+1):
        a[i]=a[i]+W[j] j range(0,i+1) range 0 i+1 i 1 a[i]=a[i]+W[j] a[i] a i a[i]+W[j] a[i] a i W[j] W j for i in range(0,N):
    b[i]=SUM-a[i] i range(0,N) range 0 N b[i]=SUM-a[i] b[i] b i SUM-a[i] SUM a[i] a i for i in range(0,N):
    c[i]=abs(a[i]-b[i]) i range(0,N) range 0 N c[i]=abs(a[i]-b[i]) c[i] c i abs(a[i]-b[i]) abs a[i]-b[i] a[i] a i b[i] b i print(min(c)) print min(c) min c N=int(input()) int(input()) N W=list(map(int,input().split())) list(map(int,input().split())) W SUM=sum(W) sum(W) SUM a=[] [] a c=[] [] c b=[] [] b
N=int(input())
W=list(map(int,input().split()))
SUM=sum(W)
a=[]
b=[]
c=[]
for i in range (N):
    a.append(0)
for i in range (N):
    b.append(0)
for i in range (N):
    c.append(0)
for i in range(0,N):
    for j in range(0,i+1):
        a[i]=a[i]+W[j]
for i in range(0,N):
    b[i]=SUM-a[i]
for i in range(0,N):
    c[i]=abs(a[i]-b[i])
print(min(c))