import itertools
INF = 1000000007
n, a, b, c = map(int, input().split())
B = [a, b, c]
take = [int(input()) for i in range(n)]
sh = [i for i in itertools.product(range(4), repeat=n)]
res = INF
for C in sh:
    ex = [0] * 3
    ifres = 0
    for index, x in enumerate(C):
        if x != 3:
            if ex[x] != 0:
                ifres += 10
            ex[x] += take[index]
    for i in range(3):
        ifres += abs(B[i]-ex[i])
    if ifres < res:
        res = ifres
print(res)