
ans = 100000000000000000000000000
N, A, B, C = map(int,input().split())
l = [int(input()) for _ in range(N)]

#rec part
def rec(a,b,c,gousei,now):
    global ans

    if(a != 0 or b != 0 or c != 0):
        ans = min(ans,(abs(a-A)+abs(b-B)+abs(c-C)+gousei*10))
        #print(a,b,c,ans) 

    if now == N:
        return 0


    #A
    rec(a,b,c, gousei,now+1)
    rec(a+l[now],b,c,gousei+1 if a!= 0 else gousei,now+1)
    rec(a,b+l[now],c,gousei+1 if b!= 0 else gousei,now+1)
    rec(a,b,c+l[now],gousei+1 if c!= 0 else gousei,now+1)


    
rec(0,0,0,0,0)
print(ans)