import itertools
import numpy as np
import copy

N, A, B, C = map(int, input().split(' '))
target = [A, B, C]
length = []
for i in range(N):
    length.append(int(input()))
    
mana = 0
for i in target:
    if(i in length):
        target.remove(i)
        length.remove(i)
        
for i in target:
    if(i < min(length)):
        mana += min(length) - i
        target.remove(i)
        length.remove(min(length))

target_comb = list(itertools.permutations(target, len(target)))
mana_cost = []
length_copy = copy.deepcopy(length)
for target in target_comb:
    length = copy.deepcopy(length_copy)
    for target_num in target:
        """
        length = sorted(length)        
        for num in range(1, len(length)+1):
            if(sum(length[:num]) > target_num):
                break
        """
        
        combs = []
        for i in range(1, len(length)+1):
            combs = combs + list(itertools.combinations(length, i))
        
        #combs = [flatten for inner in combs for flatten in inner]
        cost = np.zeros(len(combs))
        for col, comb_num in enumerate(combs):
            cost[col] = abs(target_num - sum(comb_num)) + (len(comb_num)-1)*10
        
        arg_min = cost.argmin()
        mana += cost[arg_min]
        for i in combs[arg_min]:
            length.remove(i)
        #print(length)
        #print(combs[arg_min])
    mana_cost.append(int(mana))
print(min(mana_cost))