N,A,B,C=map(int,input().split())
L=[int(input()) for _ in range(N)]

#for i in range(N):
#    L.append(int(input())

ans=10**18
def cost_calc(pp,TAKEs):
    if TAKEs==[]:
        return 10**8
    
    else:
        ans=0
        ans+=(len(TAKEs)-1)*10
        ans+=abs(pp-sum(TAKEs))
        return ans

assign=[]#[A,B,C,none]

for pattern in product([0,1,2,3],repeat=N):
    MP=0
    take=[0]*3
    for index,length in zip(pattern,l):
        if index==3:
            continue
        if take[index]!=0:
            MP+=10
        take[index]+=length
    if take[0]!=0 and take[1]!=0 and take[2]!=0:
        MP+=abs(A-take[0])
        MP+=abs(B-take[1])
        MP+=abs(C-take[2])
        ans=min(MP,ans)
print(ans)