from itertools import product

import numpy as np

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

for i in range(N):
    l.append(int(input()))

l = np.array(l)

###########

'''
Aの竹の材料にする、Bの竹の材料にする、Cの竹の材料にする、使わない
'''

min_cost = 1e10

for i in product(np.arange(4), repeat=N):
    i = np.array(i)

    if(np.sum(np.unique(i)) == 6):
        continue

    for_a = l[i == 0]
    for_b = l[i == 1]
    for_c = l[i == 2]

    A_diff = np.abs(np.sum(for_a) - A) + (len(for_a) - 1) * 10
    B_diff = np.abs(np.sum(for_b) - B) + (len(for_b) - 1) * 10
    C_diff = np.abs(np.sum(for_c) - C) + (len(for_c) - 1) * 10

    cost = A_diff + B_diff + C_diff

    if(cost < min_cost):
        min_cost = cost

print(min_cost)