N,A,B,C=map(int,input().split(" "))
INF=10**9
tmp=[int(input()) for _ in range(N)]
def calc(num,a,b,c):
    if(num==N):
        if(min(a,b,c)>0):
            return abs(A-a)+abs(B-b)+abs(C-c)-30
        else:
            return INF
    res=calc(num+1,a,b,c)
    res1=calc(num+1,a+tmp[num],b,c)+10
    res2=calc(num+1,a,b+tmp[num],c)+10
    res3=calc(num+1,a,b,c+tmp[num])+10
    return min(res,res1,res2,res3)
print(calc(0,0,0,0))
