import itertools
import numpy as np

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))

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(cost[arg_min])
    #print(combs[arg_min])
print(mana)