N,A,B,C=map(int,input().split())
L = []
for i in range(N):
    L.append(int(input()))

def dfs(n,a,b,c):
    if n == N:
        if min(a,b,c)>0:
            return abs(A-a)+abs(B-b)+abs(C-c)-30
        else:
            return 10000
    root1=dfs(n+1,a+L[n],b,c)+10
    root2=dfs(n+1,a,b+L[n],c)+10
    root3=dfs(n+1,a,b,c+L[n])+10
    root4=dfs(n+1,a,b,c)
    return min(root1,root2,root3,root4)
    
print(dfs(0,0,0,0))

