import copy 

n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
table=[]
for i in range(4**n):
    lis=[]
    x=copy.deepcopy(i)
    for j in range(n):
        lis.append(x%4)
        x=x//4
    table.append(lis)
ans=float('inf')
for i in table:
    x,y,z=0,0,0
    ans_sub=0
    cnt=-3
    for j in range(n):
        if i[j]==1:
            x+=l[j]
            cnt+=1
        elif i[j]==2:
            y+=l[j]
            cnt+=1
        elif i[j]==3:
            z+=l[j]
            cnt+=1
    ans_sub+=abs(a-x)+abs(b-y)+abs(c-z)+max(cnt,0)*10
    ans=min(ans,ans_sub)
print(ans)