#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n = int(input())
w = [int(x) for x in input().split()]
print(min(abs(sum(w[:i]) - sum(w[i:])) for i in range(n))) import sys sys input = lambda: sys.stdin.readline().strip() input lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x w = [int(x) for x in input().split()] w [int(x) for x in input().split()] print(min(abs(sum(w[:i]) - sum(w[i:])) for i in range(n))) print min(abs(sum(w[:i]) - sum(w[i:])) for i in range(n)) min abs(sum(w[:i]) - sum(w[i:])) abs sum(w[:i]) - sum(w[i:]) sum(w[:i]) sum w[:i] w :i i sum(w[i:]) sum w[i:] w i: i n = int(input()) int(input()) n w = [int(x) for x in input().split()] [int(x) for x in input().split()] w input = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() input
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n = int(input())
w = [int(x) for x in input().split()]
print(min(abs(sum(w[:i]) - sum(w[i:])) for i in range(n)))