N,A,B,C = map(int, input().split())
l = [int(input()) for _ in range(N)]

INF = 1<<20

def perm(n, a, b, c):
    if n == N:
        if all([a, b, c]):
            return abs(A-a)+abs(B-b)+abs(C-c)-30
        else:
            return INF
    return min(
        perm(n+1,a,b,c),
        perm(n+1,a+l[n],b,c)+10,
        perm(n+1,a,b+l[n],c)+10,
        perm(n+1,a,b,c+l[n])+10
        )

print(perm(0,0,0,0))
