N,A,B,C = map(int, input().split())
l = [0]*N
for i in range(N):
    l[i] = int(input())
def dfs(i,a,b,c):
    if i == N:
        if a==0 or b==0 or c==0:
            return 100000
        else:
            return abs(A-a)+abs(B-b)+abs(C-c)-30
    else:
         return min(dfs(i+1,a+l[i],b,c)+10, dfs(i+1,a,b+l[i],c)+10, dfs(i+1,a,b,c+l[i])+10, dfs(i+1,a,b,c))

print(dfs(0,0,0,0))
