n = int(input())
w = list(map(int, input().split()))
left, right = w[0], sum(w[1:])
ans = abs(left - right)
for i in range(1, n - 1):
    left += w[i]
    right -= w[i]
    ans = min(ans, abs(left - right))
print(ans) 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 left, right = w[0], sum(w[1:]) left w[0] w 0 right sum(w[1:]) sum w[1:] w 1: 1 ans = abs(left - right) ans abs(left - right) abs left - right left right for i in range(1, n - 1):
    left += w[i]
    right -= w[i]
    ans = min(ans, abs(left - right)) i range(1, n - 1) range 1 n - 1 n 1 left += w[i] left w[i] w i right -= w[i] right w[i] w i ans = min(ans, abs(left - right)) ans min(ans, abs(left - right)) min ans abs(left - right) abs left - right left right print(ans) print ans n = int(input()) int(input()) n left, right = w[0], sum(w[1:]) w[0] left right = w[0], sum(w[1:]) sum(w[1:]) right right -= w[i] w[i] right ans = abs(left - right) abs(left - right) ans left += w[i] w[i] left ans = min(ans, abs(left - right)) min(ans, abs(left - right)) ans w = list(map(int, input().split())) list(map(int, input().split())) w
n = int(input())
w = list(map(int, input().split()))
left, right = w[0], sum(w[1:])
ans = abs(left - right)
for i in range(1, n - 1):
    left += w[i]
    right -= w[i]
    ans = min(ans, abs(left - right))
print(ans)
