import itertools
import numpy as np
import copy


ansl = []
N, A, B, C = list(map(int, input().split()))

a = []
for i in range(N):
    a.append(int(input()))

def get_ptn(la):
    ptn = []
    for i in range(1, len(la) + 1):
        ptn.append(list(itertools.combinations(la, i)))
    return ptn

takes = list(itertools.permutations([A, B, C]))


for take in takes:
    # print(take)
    # print(a)
    ta = copy.deepcopy(a)
    ans = 0
    for k in range(3):

        # print(a)
        ptn = get_ptn(ta)

        # print(ptn)
        cost = []
        tmp = []

        for i in range(len(ptn)):
            tmp.append([abs(take[k] - sum(j)) for j in ptn[i]])
            cost.append(min(tmp[i]) + 10 * i)
        # print(cost)
        ans += min(cost)
        ac = np.argmin(cost)
        # print(np.argmin(cost))
        # print(ptn[ac])
        # print(tmp[ac])
        at = np.argmin(tmp[ac])
        # print(ptn[ac][at])

        for _ in ptn[ac][at]:
            ta.remove(_)

    ansl.append(ans)

print(min(ansl))
