from itertools import product
n,*X=map(int,input().split())
L=[int(input()) for _ in range(n)]
P=product(range(4),repeat=n)
ans=float("inf")
for i in P:
    cnt=[0]*3
    length=[0]*3
    for k in range(n):
        if i[k]==3:
            continue
        cnt[i[k]]+=1
        length[i[k]]+=L[k]
    if min(cnt)>0:
        tmp=sum([abs(length[i]-X[i])+10*(cnt[i]-1) for i in range(3)])
        ans=min(ans,tmp)
print(ans)