import itertools
N, a, b, c = [int(_) for _ in input().split()]
L = [int(input()) for _ in range(N)]
ans = float('inf')
for K in itertools.product(range(4), repeat=N):
    A = [[] for _ in range(N)]
    for i in range(N):
        k = K[i]
        A[k] += [L[i]]
    if len(A[1]) and len(A[2]) and len(A[3]):
        cost = 10 * (max(len(A[1]) - 1, 0) + max(len(A[2]) - 1, 0) + max(
            len(A[3]) - 1, 0))
        cost += abs(a - sum(A[1]))
        cost += abs(b - sum(A[2]))
        cost += abs(c - sum(A[3]))
        ans = min(cost, ans)
print(ans)
