
def minMP(length,LIST):
    k=len(LIST)
    LONG=[]
    if k==0:
        return -1
    for i in range(1,2**k):
        long=0
        cnt=-1
        for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
        LONG.append([long,10*cnt])
    
    ans=float("inf")
    for ll,mp in LONG:
        ans=min(ans,mp+abs(ll-length))
    return ans 

N,a,b,c=map(int,input().split())
L=[]
Ans=float("inf")
for i in range(N):
    l=int(input())
    L.append(l)

for n in range(3**N):
    L_A=[];L_B=[];L_C=[]
    for i in range(N):
        mod=n%3
        n//=3
        if mod==0:
            L_A.append(L[i])
        elif mod==1:
            L_B.append(L[i])
        else:
            L_C.append(L[i])
    MP_A=minMP(a,L_A)
    MP_B=minMP(b,L_B)
    MP_C=minMP(c,L_C)
    
    if MP_A==-1 or MP_B==-1 or MP_C==-1:
        continue
    else:
        Ans=min(Ans,MP_A+MP_B+MP_C)

print(Ans) def minMP(length,LIST):
    k=len(LIST)
    LONG=[]
    if k==0:
        return -1
    for i in range(1,2**k):
        long=0
        cnt=-1
        for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
        LONG.append([long,10*cnt])
    
    ans=float("inf")
    for ll,mp in LONG:
        ans=min(ans,mp+abs(ll-length))
    return ans  minMP k=len(LIST) k len(LIST) len LIST LONG=[] LONG [] if k==0:
        return -1
     k==0 k 0 return -1 -1 for i in range(1,2**k):
        long=0
        cnt=-1
        for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
        LONG.append([long,10*cnt])
    
     i range(1,2**k) range 1 2**k 2 k long=0 long 0 cnt=-1 cnt -1 for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
         j range(k) range k mod=i%2 mod i%2 i 2 if mod==1:
                long+=LIST[j]
                cnt+=1
             mod==1 mod 1 long+=LIST[j] long LIST[j] LIST j cnt+=1 cnt 1 i//=2 i 2 LONG.append([long,10*cnt]) LONG.append LONG append [long,10*cnt] long 10*cnt 10 cnt ans=float("inf") ans float("inf") float "inf" for ll,mp in LONG:
        ans=min(ans,mp+abs(ll-length))
     ll mp LONG ans=min(ans,mp+abs(ll-length)) ans min(ans,mp+abs(ll-length)) min ans mp+abs(ll-length) mp abs(ll-length) abs ll-length ll length return ans ans length length LIST LIST N,a,b,c=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split a b c L=[] L [] Ans=float("inf") Ans float("inf") float "inf" for i in range(N):
    l=int(input())
    L.append(l) i range(N) range N l=int(input()) l int(input()) int input() input L.append(l) L.append L append l for n in range(3**N):
    L_A=[];L_B=[];L_C=[]
    for i in range(N):
        mod=n%3
        n//=3
        if mod==0:
            L_A.append(L[i])
        elif mod==1:
            L_B.append(L[i])
        else:
            L_C.append(L[i])
    MP_A=minMP(a,L_A)
    MP_B=minMP(b,L_B)
    MP_C=minMP(c,L_C)
    
    if MP_A==-1 or MP_B==-1 or MP_C==-1:
        continue
    else:
        Ans=min(Ans,MP_A+MP_B+MP_C) n range(3**N) range 3**N 3 N L_A=[] L_A [] L_B=[] L_B [] L_C=[] L_C [] for i in range(N):
        mod=n%3
        n//=3
        if mod==0:
            L_A.append(L[i])
        elif mod==1:
            L_B.append(L[i])
        else:
            L_C.append(L[i])
     i range(N) range N mod=n%3 mod n%3 n 3 n//=3 n 3 if mod==0:
            L_A.append(L[i])
        elif mod==1:
            L_B.append(L[i])
        else:
            L_C.append(L[i])
     mod==0 mod 0 L_A.append(L[i]) L_A.append L_A append L[i] L i elif mod==1:
            L_B.append(L[i])
         mod==1 mod 1 L_B.append(L[i]) L_B.append L_B append L[i] L i L_C.append(L[i]) L_C.append L_C append L[i] L i MP_A=minMP(a,L_A) MP_A minMP(a,L_A) minMP a L_A MP_B=minMP(b,L_B) MP_B minMP(b,L_B) minMP b L_B MP_C=minMP(c,L_C) MP_C minMP(c,L_C) minMP c L_C if MP_A==-1 or MP_B==-1 or MP_C==-1:
        continue
    else:
        Ans=min(Ans,MP_A+MP_B+MP_C) MP_A==-1 or MP_B==-1 or MP_C==-1 MP_A==-1 or MP_B==-1 MP_A==-1 MP_A -1 MP_B==-1 MP_B -1 MP_C==-1 MP_C -1 continue Ans=min(Ans,MP_A+MP_B+MP_C) Ans min(Ans,MP_A+MP_B+MP_C) min Ans MP_A+MP_B+MP_C MP_A+MP_B MP_A MP_B MP_C print(Ans) print Ans a,b,c=map(int,input().split()) map(int,input().split()) a c=map(int,input().split()) map(int,input().split()) c MP_B=minMP(b,L_B) minMP(b,L_B) MP_B N,a,b,c=map(int,input().split()) map(int,input().split()) N b,c=map(int,input().split()) map(int,input().split()) b l=int(input()) int(input()) l L_C=[] [] L_C n//=3 3 n Ans=float("inf") float("inf") Ans L_B=[] [] L_B MP_C=minMP(c,L_C) minMP(c,L_C) MP_C L=[] [] L mod=n%3 n%3 mod Ans=min(Ans,MP_A+MP_B+MP_C) min(Ans,MP_A+MP_B+MP_C) Ans def minMP(length,LIST):
    k=len(LIST)
    LONG=[]
    if k==0:
        return -1
    for i in range(1,2**k):
        long=0
        cnt=-1
        for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
        LONG.append([long,10*cnt])
    
    ans=float("inf")
    for ll,mp in LONG:
        ans=min(ans,mp+abs(ll-length))
    return ans  def minMP(length,LIST):
    k=len(LIST)
    LONG=[]
    if k==0:
        return -1
    for i in range(1,2**k):
        long=0
        cnt=-1
        for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
        LONG.append([long,10*cnt])
    
    ans=float("inf")
    for ll,mp in LONG:
        ans=min(ans,mp+abs(ll-length))
    return ans  minMP L_A=[] [] L_A MP_A=minMP(a,L_A) minMP(a,L_A) MP_A

def minMP(length,LIST):
    k=len(LIST)
    LONG=[]
    if k==0:
        return -1
    for i in range(1,2**k):
        long=0
        cnt=-1
        for j in range(k):
            mod=i%2
            if mod==1:
                long+=LIST[j]
                cnt+=1
            i//=2
        LONG.append([long,10*cnt])
    
    ans=float("inf")
    for ll,mp in LONG:
        ans=min(ans,mp+abs(ll-length))
    return ans 

N,a,b,c=map(int,input().split())
L=[]
Ans=float("inf")
for i in range(N):
    l=int(input())
    L.append(l)

for n in range(3**N):
    L_A=[];L_B=[];L_C=[]
    for i in range(N):
        mod=n%3
        n//=3
        if mod==0:
            L_A.append(L[i])
        elif mod==1:
            L_B.append(L[i])
        else:
            L_C.append(L[i])
    MP_A=minMP(a,L_A)
    MP_B=minMP(b,L_B)
    MP_C=minMP(c,L_C)
    
    if MP_A==-1 or MP_B==-1 or MP_C==-1:
        continue
    else:
        Ans=min(Ans,MP_A+MP_B+MP_C)

print(Ans)