N = int (input())
W = list(map(int, input().split()))
w = 0
for i in range(N - 1):
    w += W[i]
    if w > sum(W) / 2:
        break
print(min(abs(sum(W[0: i]) - sum(W[i: N])), abs(sum(W[0: i + 1]) - sum(W[i + 1: N])))) 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 w = 0 w 0 for i in range(N - 1):
    w += W[i]
    if w > sum(W) / 2:
        break i range(N - 1) range N - 1 N 1 w += W[i] w W[i] W i if w > sum(W) / 2:
        break w > sum(W) / 2 w sum(W) / 2 sum(W) sum W 2 break print(min(abs(sum(W[0: i]) - sum(W[i: N])), abs(sum(W[0: i + 1]) - sum(W[i + 1: N])))) print min(abs(sum(W[0: i]) - sum(W[i: N])), abs(sum(W[0: i + 1]) - sum(W[i + 1: N]))) min abs(sum(W[0: i]) - sum(W[i: N])) abs sum(W[0: i]) - sum(W[i: N]) sum(W[0: i]) sum W[0: i] W 0: i 0 i sum(W[i: N]) sum W[i: N] W i: N i N abs(sum(W[0: i + 1]) - sum(W[i + 1: N])) abs sum(W[0: i + 1]) - sum(W[i + 1: N]) sum(W[0: i + 1]) sum W[0: i + 1] W 0: i + 1 0 i + 1 i 1 sum(W[i + 1: N]) sum W[i + 1: N] W i + 1: N i + 1 i 1 N W = list(map(int, input().split())) list(map(int, input().split())) W N = int (input()) int (input()) N w += W[i] W[i] w w = 0 0 w
N = int (input())
W = list(map(int, input().split()))
w = 0
for i in range(N - 1):
    w += W[i]
    if w > sum(W) / 2:
        break
print(min(abs(sum(W[0: i]) - sum(W[i: N])), abs(sum(W[0: i + 1]) - sum(W[i + 1: N]))))