n,A,B,C=(map(int,input().split()))
l=[int(input()) for i in range(n)]
ans=10**9
a=b=c=[]
for i in range(1<<n):
    for j in range(1<<n):
        res=0
        a=b=c=[]
        for k in range(n):
            if i&(1<<k):
                if j&(1<<k):
                    b.append(l[k])
                else:
                    a.append(l[k])
            elif j&(1<<k):
                c.append(l[k])
        if a and b and c:
            res = 10*(len(a)-1)+abs(A-sum(a))+10*(len(b)-1)+abs(B-sum(b))+10*(len(c)-1)+abs(C-sum(c))
            ans=min(ans,res)
print(ans)