n=int(input())
w=list(map(int,input().split()))
z=100
for i in range(n):
  s1=0
  s2=0
  for j in range(i+1):
    s1+=w[j]
  for k in range((n-i)-1):
    s2+=w[-(k+1)]
  if z>abs(s1-s2):
    z=abs(s1-s2)
print(z) 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 z=100 z 100 for i in range(n):
  s1=0
  s2=0
  for j in range(i+1):
    s1+=w[j]
  for k in range((n-i)-1):
    s2+=w[-(k+1)]
  if z>abs(s1-s2):
    z=abs(s1-s2) i range(n) range n s1=0 s1 0 s2=0 s2 0 for j in range(i+1):
    s1+=w[j]
   j range(i+1) range i+1 i 1 s1+=w[j] s1 w[j] w j for k in range((n-i)-1):
    s2+=w[-(k+1)]
   k range((n-i)-1) range (n-i)-1 n-i n i 1 s2+=w[-(k+1)] s2 w[-(k+1)] w -(k+1) k+1 k 1 if z>abs(s1-s2):
    z=abs(s1-s2) z>abs(s1-s2) z abs(s1-s2) abs s1-s2 s1 s2 z=abs(s1-s2) z abs(s1-s2) abs s1-s2 s1 s2 print(z) print z w=list(map(int,input().split())) list(map(int,input().split())) w n=int(input()) int(input()) n s2=0 0 s2 s1=0 0 s1 s1+=w[j] w[j] s1 z=abs(s1-s2) abs(s1-s2) z z=100 100 z s2+=w[-(k+1)] w[-(k+1)] s2
n=int(input())
w=list(map(int,input().split()))
z=100
for i in range(n):
  s1=0
  s2=0
  for j in range(i+1):
    s1+=w[j]
  for k in range((n-i)-1):
    s2+=w[-(k+1)]
  if z>abs(s1-s2):
    z=abs(s1-s2)
print(z)