N,A,B,C=map(int,input().split())

l=[int(input()) for i in range(N)]

inf=3000

def mp(g,a,b,c,):
    if g==N:
        return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else inf

    l0=mp(g+1,a+l[g],b,c)+10
    l1=mp(g+1,a,b+l[g],c)+10
    l2=mp(g+1,a,b,c+l[g])+10
    l3=mp(g+1,a,b,c)
    
    return min(l0,l1,l2,l3)

print(mp(0,0,0,0))

