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

s1 = 0
s2 = sum(w)
min_diff = s2

for x in w:
    x2 = x * 2
    if min_diff < x2:
        min_diff = min(x2 - min_diff, min_diff)
        break       
    min_diff -= x2
print(min_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 s1 = 0 s1 0 s2 = sum(w) s2 sum(w) sum w min_diff = s2 min_diff s2 for x in w:
    x2 = x * 2
    if min_diff < x2:
        min_diff = min(x2 - min_diff, min_diff)
        break       
    min_diff -= x2 x w x2 = x * 2 x2 x * 2 x 2 if min_diff < x2:
        min_diff = min(x2 - min_diff, min_diff)
        break       
     min_diff < x2 min_diff x2 min_diff = min(x2 - min_diff, min_diff) min_diff min(x2 - min_diff, min_diff) min x2 - min_diff x2 min_diff min_diff break min_diff -= x2 min_diff x2 print(min_diff) print min_diff min_diff -= x2 x2 min_diff n = int(input()) int(input()) n s1 = 0 0 s1 min_diff = s2 s2 min_diff min_diff = min(x2 - min_diff, min_diff) min(x2 - min_diff, min_diff) min_diff w = list(map(int, input().split())) list(map(int, input().split())) w s2 = sum(w) sum(w) s2 x2 = x * 2 x * 2 x2
n = int(input())
w = list(map(int, input().split()))

s1 = 0
s2 = sum(w)
min_diff = s2

for x in w:
    x2 = x * 2
    if min_diff < x2:
        min_diff = min(x2 - min_diff, min_diff)
        break       
    min_diff -= x2
print(min_diff)
