import itertools

N,A,B,C=map(int,input().split())
l=[int(input()) for i in range(N)]
PRD=list(itertools.product([0,1,2,3], repeat=N))

p=10**5
for i in range(len(PRD)):
    n,a,b,c=0,0,0,0
    for j in range(N):
        if PRD[i][j]==1:
            a+=l[j]
        elif PRD[i][j]==2:
            b+=l[j]
        elif PRD[i][j]==3:
            c+=l[j]
    if 0 in [a,b,c]:
        continue
    if p>abs(A-a)+abs(B-b)+abs(C-c):
        p=abs(A-a)+abs(B-b)+abs(C-c)
        L=PRD[i]

p+=(L.count(1)+L.count(2)+L.count(3)-3)*10
print(p)