import itertools
n,a,b,c=map(int,input().split())
ans=float("inf")
l=[]
for i in range(n):l.append(int(input()))
for i in itertools.product([1,2,3,0],repeat=n):
    if i.count(1) and i.count(2) and i.count(3):
        m=[0,0,0,0]
        for j in range(n):
            m[i[j]]+=l[j]
        ans=min(ans,abs(m[1]-a)+abs(m[2]-b)+abs(m[3]-c)+(n-i.count(0)-3)*10)
print(ans)