N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
# l wo a,b,c ni furiwakete zentansaku
def bintoset(b):
    ret = set()
    for i in range(N):
        if b & 1 == 1:
            ret.add(l[i])
        b = b >> 1
    return ret
mincost = 100000000000
for a in range(1, 1 << N):
    rest = (1 << N)  - a
    for b in range(1, rest):
        if b & a == 0:
            for c in range(1, rest - b):
                if c & (a+b) == 0:
                    aset = bintoset(a)
                    bset = bintoset(b)
                    cset = bintoset(c)
                    acost = abs(A - sum(aset)) + (len(aset) - 1) * 10
                    bcost = abs(B - sum(bset)) + (len(bset) - 1) * 10
                    ccost = abs(C - sum(cset)) + (len(cset) - 1) * 10
                    mincost = min(mincost, acost + bcost + ccost)
#                    print(acost, aset, bin(a))
#                    print(bcost, bset, bin(b))
#                    print(ccost, cset, bin(c))
#                    print()
print(mincost)
