from sys import stdin

n, a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
l = []
for _ in range(n):
    l.append(int(stdin.readline().rstrip()))
add = n - 3
ans = float('inf')
for i in range(3, n + 1):
    for i_a in range(1, i - 1):
        for i_b in range(1, i -  i_a):
            for i_c in range(1, i - i_a - i_b):
                for j in range(2 ** n):
                    j = bin(j)
                    if srt(j).count('1') == i_a:
                        lu = [l[x] if (j and (1 << x)) for x in range(n)]
                        c_a = (i_a - 1) * 10 + abs(sum(lu) - a)
                        for k in range(2 ** n):
                            k = bin(k)
                            if str(k).count('1') == i_b and str((k and j)).count('1') == 0:
                                lu = [l[x] if (k and (1 << x)) for x in range(n)]
                                c_b = (i_b - 1) * 10 + abs(sum(lu) - b)
                                for m in range(2 ** n):
                                    m = bin(m)
                                    if str(m).count('1') == i_c and str((k and j and m)).count('1') == 0:
                                        lu = [l[x] if (m and (1 << x)) for x in range(n)]
                                        c_c = (i_c - 1) * 10 + abs(sum(lu) - c)
                                        cost = a_c + b_c + c_c
                                        if ans > cost:
                                            ans = cost
print(int(ans))
