N = int(input())
W = list(map(int,input().split()))
m = sum(W)

for j in range(N-1):
    W1 = W[:j+1]
    W2 = W[j+1:N]
    s = abs(sum(W1) - sum(W2))
    m = min(m, s)

print(m) 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 m = sum(W) m sum(W) sum W for j in range(N-1):
    W1 = W[:j+1]
    W2 = W[j+1:N]
    s = abs(sum(W1) - sum(W2))
    m = min(m, s) j range(N-1) range N-1 N 1 W1 = W[:j+1] W1 W[:j+1] W :j+1 j+1 j 1 W2 = W[j+1:N] W2 W[j+1:N] W j+1:N j+1 j 1 N s = abs(sum(W1) - sum(W2)) s abs(sum(W1) - sum(W2)) abs sum(W1) - sum(W2) sum(W1) sum W1 sum(W2) sum W2 m = min(m, s) m min(m, s) min m s print(m) print m W1 = W[:j+1] W[:j+1] W1 N = int(input()) int(input()) N m = sum(W) sum(W) m s = abs(sum(W1) - sum(W2)) abs(sum(W1) - sum(W2)) s m = min(m, s) min(m, s) m W2 = W[j+1:N] W[j+1:N] W2 W = list(map(int,input().split())) list(map(int,input().split())) W
N = int(input())
W = list(map(int,input().split()))
m = sum(W)

for j in range(N-1):
    W1 = W[:j+1]
    W2 = W[j+1:N]
    s = abs(sum(W1) - sum(W2))
    m = min(m, s)

print(m)
