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

import numpy as np

w = np.cumsum(W)

print(int(min(abs(sum(W)/2 - w))*2)) 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 import numpy as np numpy w = np.cumsum(W) w np.cumsum(W) np.cumsum np cumsum W print(int(min(abs(sum(W)/2 - w))*2)) print int(min(abs(sum(W)/2 - w))*2) int min(abs(sum(W)/2 - w))*2 min(abs(sum(W)/2 - w)) min abs(sum(W)/2 - w) abs sum(W)/2 - w sum(W)/2 sum(W) sum W 2 w 2 N = int(input()) int(input()) N W = list(map(int,input().split())) list(map(int,input().split())) W w = np.cumsum(W) np.cumsum(W) w
N = int(input())
W = list(map(int,input().split()))

import numpy as np

w = np.cumsum(W)

print(int(min(abs(sum(W)/2 - w))*2))