import itertools

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

def score(x,NOW):
    L=len(NOW)
    ITE=list(itertools.product([0,1],repeat=L))

    ANS=10**15
    CANDI=[]

    for ite in ITE:
        if max(ite)==0:
            continue
        SUM=sum([NOW[i] for i in range(L) if ite[i]==1])        
        MAGIC=(ite.count(1)-1)*10
        

        if ANS>MAGIC+abs(x-SUM):
            ANS=MAGIC+abs(x-SUM)
            CANDI=ite

    return ANS,[NOW[i] for i in range(L) if CANDI[i]==0]

X=[[A,B,C],[A,C,B],[B,A,C],[B,C,A],[C,A,B],[C,B,A]]
ANS=10**15

for x in X:
    ANS1,L1=score(x[0],L)
    ANS2,L2=score(x[1],L1)
    ANS3,L3=score(x[2],L2)

    #print(ANS,ANS1,ANS2,ANS3,L1,L2,L3,A,B,C)

    if ANS>ANS1+ANS2+ANS3:
        ANS=ANS1+ANS2+ANS3

print(ANS)