from itertools import product
N,*ABC=map(int,input().split())
L=list(int(input()) for _ in range(N))
mp=10**9
for i in product([0,1,2,3] ,repeat=N):
    if {0,1,2}<=set(i):
        m=[0,0,0]
        for x,y in zip(i,L):
            if x!=3:
                m[x]+=y
        t=sum(abs(p-q) for p,q in zip(ABC,m))
        r=sum(1 if k!=3 else 0 for k in i)-3
        mp=min(mp,t+r*10)
print(mp)
