
N,A,B,C = input().split()

N= int(N)
A= int(A)
B= int(B)
C= int(C)

stick =[]
leng = []
left_nums = ""
all_zero = ""


for i in range(N):

    x = int(input())
    stick.append(x)
    left_nums += "1"
    all_zero += "0"


for i in range(2 ** N):

    uses_int = format(i,'b')
    uses = uses_int.zfill(N)

    lensum = 0
    
    for j in range(N):

        if (uses[j] == "1"):
            lensum += stick[j]

    leng.append( [lensum , uses] )

#print (leng)


order = ((A,B,C),(A,C,B),(B,A,C),(B,C,A),(C,A,B),(C,B,A))


mini_last = 3000

for i in range(6): #ABC全ての順番において最小を調べる

    point = 0
    lefts = left_nums # 1がN個並んでいる文字列
    

    for j in range(3): #A,B,Cそれぞれの場合において最小を考察&出力

            
            goal = order[i][j] #近づける値

            mini_point = 1000
            mini_num = ""

            for k in leng:

                if (  abs( k[0] - goal ) + ( k[1].count('1') - 1 ) * 10 < mini_point and abs( k[0] - goal ) + ( k[1].count('1') - 1 ) * 10 >= 0  and k[1] != all_zero ):

                    flag = True
                    for m in range(N):

                        if (lefts[m] == "0" and k[1][m] == "1"):
                            flag = False
                            #print ("lefts:",lefts," nowk1:",k[1])

                    if (flag):
                        mini_point = abs( k[0] - goal ) + ( k[1].count('1') - 1 ) * 10
                        mini_num = k[1]


            for m in range(N):

                if (mini_num[m] == "1"):
                    lef_lis = list(lefts)
                    lef_lis[m] = "0"
                    lefts = "".join(lef_lis)

            point += mini_point

            #print ("mp:",mini_point ," mn:",mini_num)

    if (point < mini_last):
        mini_last = point


print (mini_last)

            

            

            
        
            





            
