N,A,B,C=map(int, input().split())
l=[int(input()) for i in range(N)]
from itertools import product
p=list(product([0,1,2,3],repeat=N))
t=1000
for i in p:
    a=b=c=ac=0
    for j in range(N):
        if i[j]==1:
            a+=l[j]
            ac+=1
        elif i[j]==2:
            b+=l[j]
            ac+=1
        elif i[j]==3:
            c+=l[j]
            ac+=1
    if a and b and c:
        tt=abs(a-A)+abs(b-B)+abs(c-C)+(ac-3)*10
        if t>tt:
            t=tt
print(t)