import itertools

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

for n in range(1, N + 1):
    P.extend(itertools.combinations([n for n in range(N)], n))

add_len = {s: sum(L[i] for i in s) for s in P}


def cost(v, s):
    return 10 * (len(s) - 1) + abs(v - add_len[s])


res = 2 << 30
for a in P:
    cost_a = cost(A, a)
    if res < cost_a:
        continue

    for b in P:
        cost_b = cost(B, b)
        if res < cost_b:
            continue

        if len(set(a) & set(b)):
            continue

        for c in P:
            cost_c = cost(C, c)
            if res < cost_c:
                continue

            if len(set(a) & set(c)) or len(set(b) & set(c)):
                continue
            res = min(res, cost_a + cost_b + cost_c)

print(res)
