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

def get_cost(bamboos, mokuhyo):
    return 10 * (len(bamboos) - 1) + np.abs(bamboos.sum() - mokuhyo)

from itertools import product
import sys
result = sys.maxsize
for pair in product(*([np.arange(4)] * N)):
    if (np.bincount(np.array(pair), minlength=3) == 0).any():
        continue
    cost = 0
    for i, mokuhyo in enumerate([A, B, C]):
        bamboos = ls[np.array(pair) == i]
        cost += get_cost(bamboos, mokuhyo)
    if cost < result:
        result = cost
print(result)