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

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

def bamboo_search(l,a,b,c):
    if l==N:
        return abs(A-a)+abs(B-b)+abs(C-c)-30
    else:
        bcan = bamboo_search(l+1,a,b,c)
        ba = bamboo_search(l+1,a+L[l],b,c)+10
        bb = bamboo_search(l+1,a,b+L[l],c)+10
        bc = bamboo_search(l+1,a,b,c+L[l])+10
        return min(bcan,ba,bb,bc)
    
print(bamboo_search(0,0,0,0))