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

def calc_cost(num, group):
    cost = 10 * (len(group) - 1) + abs(sum(group) - num)
    return cost

cand = []
for n in range(4 ** N):
    groups = [[], [], []]
    for i in range(N):
        temp = n % 4
        if n > 0:
            groups[temp-1].append(i)
        n = n // 4
    if len(groups[0]) * len(groups[1]) * len(groups[2]) > 0: 
        cand.append(calc_cost(A, groups[0]) + calc_cost(B, groups[1]) + calc_cost(C, groups[2]))
print(min(cand))