import itertools

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

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

todo_list = [0,1,2,3]

todo_comb = itertools.product(todo_list, repeat=5)

ABCNo = [[],[],[],[]]

MP = float('inf')

for todo in todo_comb:
    for i in range(N):
        ABCNo[todo[i]].append(l_list[i])

    if ABCNo[0] == [] or ABCNo[1] == [] or ABCNo[2] == []:
        continue

    AA = sum(ABCNo[0])
    BB = sum(ABCNo[1])
    CC = sum(ABCNo[2])

    tmp = abs(AA-A) + abs(BB-B) + abs(CC-C)
    tmp += (len(ABCNo[0]) + len(ABCNo[1]) + len(ABCNo[2]))*10

    if tmp < MP:
        MP = tmp

print(tmp)