from itertools import product
N, *ABC = map(int, input().split())
L = [int(input()) for _ in range(N)]
ans = float("inf")
for prod in product(range(4), repeat=N):
    abc = [0] * 3
    mp = -30
    for p, l in zip(prod, L):
        if p != 3:
            abc[p] += l
            mp += 10
    if abc[0] and abc[1] and abc[2]:
        mp += sum(map(lambda x,y: abs(x-y), ABC, abc))
        ans = min(ans, mp)
print(ans)