import itertools 
def diff(a,b,c):
    return abs(A-a)+abs(B-b)+abs(C-c)
    
N,A,B,C,*l=map(int,open(0).read().split())
_min=10**6
for i in itertools.product([0,1,2,3],repeat=N):
    cnt=0
    abc=[0,0,0]
    for j in range(N):
        if i[j] !=3:
            abc[i[j]]+=l[j]
            cnt+=1
    if 0 in abc:
        continue
    _min=min(_min,10*cnt-30+diff(abc[0],abc[1],abc[2]))
print(_min)    
    