from itertools import product
N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
ans = min(
    sum(
        abs(sum(x for k, x in zip(p, l) if k == r) - y) + 10 * (p.count(r) - 1)
        for r, y in enumerate((A, B, C), 1)
    )
    for p in product(range(4), repeat=N)
    if {1, 2, 3} <= set(p)
)
print(ans)
