import itertools
n,a,b,c=map(int,input().split())
l=[int(input()) for _ in range(n)]
li=[0,1,2,3]
it = list(itertools.product(li,repeat=n))
it = [i for i in it if 0 in i and 1 in i and 2 in i]
INF=100000007
ans=INF
for i in it:
    tmp=-30
    l_tmp=[0,0,0,0]
    for j in range(n):
        l_tmp[i[j]]+=l[j]
        if i[j]!=3:tmp+=10
    tmp=tmp+abs(l_tmp[0]-a)+abs(l_tmp[1]-b)+abs(l_tmp[2]-c)
    if tmp<ans:ans=tmp
print(ans)