import itertools
import sys

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

ABC_list = [A,B,C]
ABC_list.sort()

l_list = []
for i in range(N):
    l_list.append(int(input()))
l_list.sort()

MP = float('inf')

for i in range(len(ABC_list),len(l_list)+1):
    pena = (i - 3)*10
    cs = itertools.combinations(range(1,i),2)
    for c in cs:
        ps = itertools.combinations(l_list,i)
        for p in ps:
            AA = sum(p[:c[0]])
            BB = sum(p[c[0]:c[1]])
            CC = sum(p[c[1]:])
            test = [AA,BB,CC]
            test.sort()
            tmp = abs(test[0]-ABC_list[0]) + abs(test[1]-ABC_list[1]) + abs(test[2]-ABC_list[2]) + pena
            if tmp < MP:
                MP = tmp
        for p in ps:
            AA = sum(p[:c[0]])
            CC = sum(p[c[0]:c[1]])
            BB = sum(p[c[1]:])
            test = [AA,BB,CC]
            test.sort()
            tmp = abs(test[0]-ABC_list[0]) + abs(test[1]-ABC_list[1]) + abs(test[2]-ABC_list[2]) + pena
            if tmp < MP:
                MP = tmp

        for p in ps:
            BB = sum(p[:c[0]])
            AA = sum(p[c[0]:c[1]])
            CC = sum(p[c[1]:])
            test = [AA,BB,CC]
            test.sort()
            tmp = abs(test[0]-ABC_list[0]) + abs(test[1]-ABC_list[1]) + abs(test[2]-ABC_list[2]) + pena
            if tmp < MP:
                MP = tmp
        for p in ps:
            BB = sum(p[:c[0]])
            CC = sum(p[c[0]:c[1]])
            AA = sum(p[c[1]:])
            test = [AA,BB,CC]
            test.sort()
            tmp = abs(test[0]-ABC_list[0]) + abs(test[1]-ABC_list[1]) + abs(test[2]-ABC_list[2]) + pena
            if tmp < MP:
                MP = tmp

        for p in ps:
            CC = sum(p[:c[0]])
            AA = sum(p[c[0]:c[1]])
            BB = sum(p[c[1]:])
            test = [AA,BB,CC]
            test.sort()
            tmp = abs(test[0]-ABC_list[0]) + abs(test[1]-ABC_list[1]) + abs(test[2]-ABC_list[2]) + pena
            if tmp < MP:
                MP = tmp

        for p in ps:
            CC = sum(p[:c[0]])
            BB = sum(p[c[0]:c[1]])
            AA = sum(p[c[1]:])
            test = [AA,BB,CC]
            test.sort()
            tmp = abs(test[0]-ABC_list[0]) + abs(test[1]-ABC_list[1]) + abs(test[2]-ABC_list[2]) + pena
            if tmp < MP:
                MP = tmp
print(MP)