N,A,B,C = map(int,input().split())
l=[int(input()) for _ in range(N)]
INF=10**4

def dfs(cur,a,b,c):
    if cur==N:
        return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else INF
    else:
        cost0 = dfs(cur+1,a,b,c)
        cost1 = dfs(cur+1,a+l[cur],b,c)+10
        cost2 = dfs(cur+1,a,b+l[cur],c)+10
        cost3 = dfs(cur+1,a,b,c+l[cur])+10
        return min(cost0,cost1,cost2,cost3)

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