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

from itertools import permutations


def min_cost(g_list):
    g1, g2, g3 = g_list
    return abs(g1 - A) + abs(g2 - B) + abs(g3 - C)


ans = []
for LL in permutations(L):
    for p1 in range(1, N - 1):
        for p2 in range(p1+1, N):
            for p3 in range(p2 + 1, N+1):
                g1, g2, g3 = sum(LL[:p1]), sum(LL[p1:p2]), sum(LL[p2:p3])
                syn = [len(
                    L[:p1])-1, len(L[p1:p2])-1, len(L[p2:p3])-1]
                # print(g1, g2, g3)
                # print(p1, p2, p3)
                # print(syn)
                ans.append(min_cost([g1, g2, g3]) + sum(syn) * 10)
    # break

print(min(ans))
# print(ans)
