from itertools import*
n,a,b,c,*l=map(int,open(0).read().split())
ans=float("inf")
for i in product(range(4),repeat=n): #3を捨てる
    take=[[],[],[]]
    for k,j in enumerate(i):
        if j==3:
            continue
        take[j].append(l[k])
    *tmp,=map(len,take)
    if all(tmp):
        x,y,z=map(sum,take)
        ans=min(ans, (sum(tmp)-3)*10 + abs(x-a) + abs(y-b) + abs(z-c) )
print(ans)