N,A,B,C=map(int, input().split())
L=[int(input()) for i in range(N)]
from itertools import product
ans=10**9
for p in product(range(4),repeat=N):
    l=[0]*3
    cost=0
    for i,t in enumerate(p):
        if t<3:
            if l[t]>0:
                cost+=10
            l[t]+=L[i]
    if min(l)>0:
        ans=min(ans,cost+abs(A-l[0])+abs(B-l[1])+abs(C-l[2]))
print(ans)