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

ans = 10000000

A = [0,1,2,3]

import itertools
for a in itertools.product(A, repeat=N):
    ind_1 = [i for i, x in enumerate(a) if x == 1]
    sum_1 = 0
    for i in ind_1:
        sum_1 += l[i]
    ans_1 = 10*(len(ind_1)-1) + abs(sum_1-A)

    ind_2 = [i for i, x in enumerate(a) if x == 2]
    sum_2 = 0
    for i in ind_2:
        sum_2 += l[i]
    ans_2 = 10*(len(ind_2)-1) + abs(sum_2-B)
    
    ind_3 = [i for i, x in enumerate(a) if x == 3]
    sum_3 = 0
    for i in ind_3:
        sum_3 += l[i]
    ans_3 = 10*(len(ind_3)-1) + abs(sum_3-C)
    
    ans = min(ans, ans_1 + ans_2 + ans_3)
    
print(ans)