import numpy as np
N, A, B, C = map(int, input().split())
ls = adisps = np.array([int(input()) for _ in range(N)])

from itertools import product
import sys

result = sys.maxsize
for pair in product(*([np.arange(4)] * N)):
    pair = np.array(pair)
    if (np.bincount(pair, minlength=3) == 0).any():
        continue
    
    cost1 = np.bincount(pair, weights=ls)[:3].astype(int)
    cost1 = np.abs(cost1 - np.array([A, B, C])).sum()
    cost10 = (np.bincount(pair)[:3] - 1).sum() * 10
    cost = cost1 + cost10
    
    if cost < result:
        result = cost
print(result)