import sys
import math
import itertools
N, A, B, C = map(int, input().split())

bamboos = []

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

def bamboo(bamboos, A):
    total = 0 
    while(len(bamboos) >= 1):
        #print(bamboos)
        A_i = 0
        A_c = abs(A - bamboos[0])
        A_u = bamboos[0]

        for i in range(1, len(bamboos)):
            if A_c > abs(A - bamboos[i]):
                A_c = abs(A - bamboos[i])
                A_i = i
                A_u = bamboos[i]

        if A_c <= 10:
            total += A_c
            #print("bamboos" + str(bamboos[A_i]))
            del bamboos[A_i]
            return total
        else:
            A_c = math.inf
            iteration = 0
            A_i = 0
            A_j = 0
            for i in range(0,len(bamboos)):
                for j in range(i+1,len(bamboos)):
                    if i != j and A_c > abs(A - (bamboos[i] + bamboos[j])):
                        A_c = abs(A - (bamboos[i] + bamboos[j]))
                        A_i = i
                        A_j = j
            total += 10
            val = bamboos[A_i] + bamboos[A_j]
            #print('i' + str(bamboos[i]))
            #print('j' + str(bamboos[j]))
            #print(str(i) + ',' + str(j))
            if (A_i < A_j):
                del bamboos[A_j]
                del bamboos[A_i]
            elif (A_j < A_i):
                del bamboos[A_i]
                del bamboos[A_j]
                iteration += 1
            bamboos.append(val)
            #print(total)

    #return total

bamboos_b = bamboos.copy()

to_solve = [A,B,C]
#to_solve.sort()

#print(to_solve)

total = []

for perm in list(itertools.permutations(to_solve)):
    bamboos = bamboos_b.copy()
    t = 0
    #print()
    #print()
    #print(perm)
    for elem in perm:
        #print(bamboos)
        t += bamboo(bamboos, elem)
        #print(t)
    total.append(t)
        
print(min(total))
