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

diff = sum(W)
for w in W:
    if diff > abs(diff-2*w):
        diff -= 2 * w
    else:
        break
print(abs(diff)) 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 diff = sum(W) diff sum(W) sum W for w in W:
    if diff > abs(diff-2*w):
        diff -= 2 * w
    else:
        break w W if diff > abs(diff-2*w):
        diff -= 2 * w
    else:
        break diff > abs(diff-2*w) diff abs(diff-2*w) abs diff-2*w diff 2*w 2 w diff -= 2 * w diff 2 * w 2 w break print(abs(diff)) print abs(diff) abs diff diff -= 2 * w 2 * w diff N = int(input()) int(input()) N diff = sum(W) sum(W) diff W = list(map(int, input().split())) list(map(int, input().split())) W
N = int(input())
W = list(map(int, input().split()))

diff = sum(W)
for w in W:
    if diff > abs(diff-2*w):
        diff -= 2 * w
    else:
        break
print(abs(diff))