n,A,B,C=map(int,input().split())
L=[int(input()) for i in range(n)]
r=10**5
def dsf(i,a,b,c,p):
    global r
    if i==n:
        if a!=0 and b!=0 and c!=0:
            p+=abs(A-a)+abs(B-b)+abs(C-c)-30
            r=min(r,p)
        return
    dsf(i+1,a+L[i],b,c,p+10)
    dsf(i+1,a,b+L[i],c,p+10)
    dsf(i+1,a,b,c+L[i],p+10)
    dsf(i+1,a,b,c,p)
dsf(0,0,0,0,0)
print(r)