n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]
inf = 10 ** 10
def dfs(k, a, b, c):
    if k == n:
        if set() in (a,b,c):
            return inf
        return abs(A - sum(a)) + abs(B - sum(b)) + abs(C - sum(c)) + (len(a) + len(b) + len(c) - 3) * 10
    ret = [0] * 4
    ad = a.copy()
    bd = b.copy()
    cd = c.copy()
    ad.add(l[k])
    bd.add(l[k])
    cd.add(l[k])
    ret[0] = dfs(k+1, ad, b, c)
    ret[1] = dfs(k+1, a, bd, c)
    ret[2] = dfs(k+1, a, b, cd)
    ret[3] = dfs(k+1, a, b, c)
    return min(ret)
print(dfs(0, set(), set(), set()))
