N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
def bintoset(b):
    ret = set()
    for i in range(N):
        if b & 1 == 1:
            ret.add(l[i])
        b = b >> 1
    return ret
def cost(b, x):
    s = bintoset(b)
    return abs(x - sum(s)) + (len(s) - 1) * 10
mincost = 10000000
for a in range(1, 1 << N):
    for b in range(1, (1 << N) - a):
        if b & a == 0:
            for c in range(1, (1 << N) - a - b):
                if c & (a+b) == 0 and a * b * c != 0:
                    mincost = min(mincost, cost(a, A) + cost(b, B) + cost(c, C))
print(mincost)
