n,a,b,c=map(int,input().split())
l=sorted([int(input()) for i in range(n)])
def kad(w,x,y,z):
    if w==n:
        if min(x,y,z)>0:
            return(abs(x-a)+abs(y-b)+abs(z-c)-30)
        else:
            return a
    c0=kad(w+1,x,y,z)
    c1=kad(w+1,x+l[w],y,z)+10
    c2=kad(w+1,x,y+l[w],z)+10
    c3=kad(w+1,x,y,z+l[w])+10
    return min(c0,c1,c2,c3)

print(kad(0,0,0,0))
        