#coding:utf-8
import itertools,sys

N,A,B,C=map(int, raw_input().split())
l=[]
for _ in range(N):
    l.append(input())

def eval(a,b,c,aa,bb,cc):
    #print(a,b,c,aa,bb,cc)
    ra=a+sum(aa)
    rb=b+sum(bb)
    rc=c+sum(cc)
    #print("rarbrc:",ra,rb,rc, abs(A-ra), abs(B-rb), abs(C-rc),C,rc)
    diff = abs(A-ra) + abs(B-rb) + abs(C-rc)
    diff+=10*len(aa)
    diff+=10*len(bb)
    diff+=10*len(cc)
    return diff


cn=0
ans=1<<20
ops=[-1,0,1,2]
for a,b,c in itertools.permutations(range(N), 3):
    others=set(range(N))
    others.remove(a)
    others.remove(b)
    others.remove(c)
    others=list(others)
    for O in itertools.product(ops, repeat=len(others)):
        aa,bb,cc=[],[],[]
        for i,op in enumerate(O):
            if op==-1:continue
            if op==0:aa.append(l[others[i]])
            if op==1:bb.append(l[others[i]])
            if op==2:cc.append(l[others[i]])
        #print(aa,bb,cc)
        val=eval(l[a],l[b],l[c],aa,bb,cc)
        #print(val)
        # cn+=1
        # if cn==2:
        #     pass
            #sys.exit(0)
        ans=min(ans,val)
print(ans)
