def main():
    n, a, b, c = map(int, input().split())
    arr = [int(input()) for i in range(n)]

    min_cost = float("inf")
    for i in range(1, 2 ** n):
        bin_i = "{:08b}".format(i)[::-1]
        arr_i = [arr[x] for x in range(n) if bin_i[x] == "1"]
        cost_i = (len(arr_i) - 1) * 10
        sum_i = sum(arr_i)
    
        for j in range(1, 2 ** n):
            bin_j = "{:08b}".format(j)[::-1]
    
            if any([x == "1" and y == "1" for x, y in zip(bin_i, bin_j)]):
                continue
    
            arr_j = [arr[x] for x in range(n) if bin_j[x] == "1"]
            cost_j = (len(arr_j) - 1) * 10
            sum_j = sum(arr_j)
    
            for k in range(1, 2 ** n):
                bin_k = "{:08b}".format(k)[::-1]
    
                if any([x == "1" and y == "1" for x, y in zip(bin_i, bin_k)]):
                    continue
    
                if any([x == "1" and y == "1" for x, y in zip(bin_j, bin_k)]):
                    continue
    
                arr_k = [arr[x] for x in range(n) if bin_k[x] == "1"]
    
                cost_k = (len(arr_k) - 1) * 10
                sum_k = sum(arr_k)
    
                cost = abs(sum_i - a) + abs(sum_j - b) + abs(sum_k - c) + cost_i + cost_j + cost_k
    
                if min_cost > cost:
                    min_cost = cost
    
    print(min_cost)


main()
