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

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

temp = []
for i in range(m_num -1 ):
    temp.append(abs(sum(w[0:i+1]) - sum(w[i + 1:])))
print(min(temp))
