import numpy as np
def choose_least_diff(rest_nums, used, target, cur_step):
    #targetを実現するのに最小のパターンを探す
    if cur_step == len(rest_nums) or np.abs(target) < 10:
        #探索終了
        if np.sum(used.astype(np.int)) == 0:
            #全部offのパターンを返してしまうのを避ける
            return np.sum(rest_nums),used
        else:
            final_cost = (np.sum(used.astype(int)) - 1) * 10 + np.abs(target)
            #print(target,final_cost)
            return final_cost,used
    
    #Offパターンを試す
    ret_off,used_off = choose_least_diff(rest_nums, used, target,cur_step + 1)
        
    #Onパターンを試す
    cur_used = used.copy()
    cur_used[cur_step] = True
    ret_on,used_on = choose_least_diff(rest_nums, cur_used, target - rest_nums[cur_step],cur_step + 1)
    
    #cur_stepがOff,Onのそれぞれの場合で最も良い結果が得られるパターンを比較して良い方を返す
    if ret_on > ret_off:
        return ret_off, used_off
    else:
        return ret_on, used_on
    
def q3():
    N,A,B,C = list(map(int,input().split()))
    l = []
    for n in range(N):
        l.append(int(input()))
    l = np.array(l)
    
    min_ret = np.sum(l)
    used = np.zeros_like(l,dtype=np.bool)
    rest = [A,B,C]
    for i,first in enumerate(rest):
        ret1,used1 = choose_least_diff(l,used,first,0)
        l2 = l[~used1]
        used1 = np.zeros_like(l2,dtype=np.bool)
        for j,second in enumerate(rest):
            if i == j:
                continue
            ret2, used2 =  choose_least_diff(l2,used1,second,0)
            l3 = l2[~used2]
            used2 = np.zeros_like(l3,dtype=np.bool)
            for k, third in enumerate(rest):
                if k == i or k == j:
                    continue
                ret3, _ =  choose_least_diff(l3,used2,third,0)
                ret = ret1 + ret2 + ret3
                if ret < min_ret:
                    min_ret = ret
    print(min_ret)
    
q3()