#!/usr/bin/env python3
n, *w = map(int, open(0).read().split())
s = sum(w)
print(min(abs(s - 2 * sum(w[:i + 1])) for i in range(n))) n, *w = map(int, open(0).read().split()) n map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *w w s = sum(w) s sum(w) sum w print(min(abs(s - 2 * sum(w[:i + 1])) for i in range(n))) print min(abs(s - 2 * sum(w[:i + 1])) for i in range(n)) min abs(s - 2 * sum(w[:i + 1])) abs s - 2 * sum(w[:i + 1]) s 2 * sum(w[:i + 1]) 2 sum(w[:i + 1]) sum w[:i + 1] w :i + 1 i + 1 i 1 n, *w = map(int, open(0).read().split()) map(int, open(0).read().split()) n s = sum(w) sum(w) s
#!/usr/bin/env python3
n, *w = map(int, open(0).read().split())
s = sum(w)
print(min(abs(s - 2 * sum(w[:i + 1])) for i in range(n)))
