# coding: utf-8
N,A,B,C=map(int,input().split())
L=[]
INF=10**6

ans=INF

def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

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

for i in range(3**N):
    S=base10to(i,3).zfill(N)
    LA=[]
    LB=[]
    LC=[]
    for j in range(N):
        if S[j]=="0":
            LA.append(L[j])
        elif S[j]=="1":
            LB.append(L[j])
        elif S[j]=="2":
            LC.append(L[j])
    
    if not(LA) or not(LB) or not(LC):
        continue
    
    dpA=[[INF for b in range(1500)] for a in range(len(LA))]
    dpB=[[INF for b in range(1500)] for a in range(len(LB))]
    dpC=[[INF for b in range(1500)] for a in range(len(LC))]
    
    for a in range(len(LA)):
        l=LA[a]
        dpA[a][l]=0
        dpA[a][0]=0
        for b in range(1500):
            if a>0 and b-l>=0:
                dpA[a][b]=min(dpA[a][b],dpA[a][b-1]+1,dpA[a-1][b-l]+10)
                
        for b in range(1500):
            if b>0:
                dpA[a][-(b+1)]=min(dpA[a][b],dpA[a][-b]+1)
    
    for a in range(len(LB)):
        l=LB[a]
        dpB[a][l]=0
        dpB[a][0]=0
        for b in range(1500):
            if a>0 and b-l>=0:
                dpB[a][b]=min(dpB[a][b],dpB[a][b-1]+1,dpB[a-1][b-l]+10)
                
        for b in range(1500):
            if b>0:
                dpB[a][-(b+1)]=min(dpB[a][b],dpB[a][-b]+1)
                
    for a in range(len(LC)):
        l=LC[a]
        dpC[a][l]=0
        dpC[a][0]=0
        for b in range(1500):
            if a>0 and b-l>=0:
                dpC[a][b]=min(dpC[a][b],dpC[a][b-1]+1,dpC[a-1][b-l]+10)
                
        for b in range(1500):
            if b>0:
                dpC[a][-(b+1)]=min(dpC[a][b],dpC[a][-b]+1)
    
    ans=min(ans,dpA[len(LA)-1][A]+dpB[len(LB)-1][B]+dpC[len(LC)-1][C])

print(ans)
    
    
    
    
    
    
    
