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

# 0, 1, 2, 3(使わない) で前通り試す
from itertools import product

answer = 10 ** 18
for pattern in product(range(4), repeat=N):
    X = [0] * 3
    MP = 0
    for take, length in zip(pattern, L):
        if take == 3:
            continue
        if X[take] != 0:
            MP += 10
        X[take] += length
    MP += abs(A - X[0])
    MP += abs(B - X[1])
    MP += abs(C - X[2])
    answer = min(MP, answer)

print(answer)
