import itertools as itr

n, a, b, c = list(map(int, input().split()))
l = []
for _ in range(n):
    l.append(int(input()))
    
l.sort()

cost = 10**9
for cr in range(1, n-2):
    for ccomb in itr.combinations(l, cr):
        ccosti = abs(c-sum(ccomb)) + (cr-1)*10
        cl = l[:]
        for icomb in ccomb:
            cl.remove(icomb)
        for br in range(1, n-2-cr):
            for bcomb in itr.combinations(cl, br):
                bcosti = abs(b-sum(bcomb)) + (br-1)*10
                bl = cl[:]
                for icomb in bcomb:
                    bl.remove(icomb)
                for ar in range(1, n-2-cr-br):
                    for acomb in itr.combinations(bl, ar):
                        acosti = abs(a-sum(acomb)) + (ar-1)*10
                        if cost > ccosti + bcosti + acosti:
                            cost = ccosti + bcosti + acosti

print(cost)