from sys import setrecursionlimit
setrecursionlimit(10 ** 9)

n, a, b, c = [int(i) for i in input().split()]
L = [int(input()) for i in range(n)]

INF = 10 ** 9

def dfs(i, L, A):
    if all(a == 0 for a in A):
        return 0
    if n - L.count(0) < 3:
        return INF
    if i == n:
        return INF
    if L[i] == 0:
        return dfs(i+1, L[:], A[:])
    for j, a in enumerate(A):
        if a == L[i]:
            A[j] = 0
            return dfs(i+1, L[:], A[:])

    res = dfs(i+1, L[:], A[:])
    for j, a in enumerate(A):
        if a == 0:
            continue
        TL = L[:]
        TL[i] = a
        TA = A[:]
        TA[j] = 0
        d = abs(L[i] - a)
        res = min(res, dfs(i+1, TL, TA) + d)

    if L[i] > max(A):
        return res
    for j in range(i+1, n):
        if L[j] == 0:
            continue
        TL = L[:]
        TL[i] += TL[j]
        TL[j] = 0
        res = min(res, dfs(i, TL, A[:]) + 10)

    return res

print(dfs(0, L[:], [a, b, c]))