import itertools

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

ans = []
for X in itertools.product(range(4), repeat=N):
    P = [[] for _ in range(4)]
    for i, x in enumerate(X):
        P[x].append(l[i])
    if min(map(len, P[1:]))==0:
        continue
    
    tmp = 0
    for Q, D in zip(P[1:], [A,B,C]):
        tmp+=10*(len(Q)-1)+abs(D-sum(Q))
    ans.append(tmp)    
print(sorted(ans)[0])