# -*- coding: utf-8 -*-
n, a, b, c = map(int, input().split(" "))
take = [a, b, c]
l = []
for i in range(n):
    l.append(int(input()))
take.sort()
l.sort()
mp = 0
get = []
for i in take:
    if i in l:
        get.append(i)
for i in get:
    l.remove(i)
    take.remove(i)

get2 = []
get3 = [[],[],[]]
for i in take:
    mini = [0, 0, 10]
    mini2 = [0, 0, 10]
    mini3 = [0, 0, 10]
    for j in l:
        d = abs(i - j)
        if d <= mini[2]:
            if mini2[0] == 0 and mini[0] != 0:
                mini2 = mini
            elif mini2[0] != 0 and mini[0] != 0:
                mini3 = mini2
                mini2 = mini
            mini = [j, i, d]
    get2.append([mini, mini2, mini3])
for i in get2:
    for ii in i:
        if ii[0] == 0:
            break
        else:
            get3[0].append(ii[0])
            get3[1].append(ii[1])
            get3[2].append(ii[2])
ind = []
mark = []
for i in get3[2]:
    ii = get3[2].index(min(get3[2]))
    if get3[1][ii] not in mark:
        s = get3[0].pop(ii)
        t = get3[1].pop(ii)
        u = get3[2].pop(ii)
        ind.append([s,t,u])
        mark.append(t)
    if len(ind) == 3:
        break
for i in ind:
    l.remove(i[0])
    take.remove(i[1])
    mp += i[2]

def add_take():
    global take, l, mp
    get2 = []
    for i in take:
        added = 0
        mp2 = -10
        mini = [[], 0, 10, 0]
        for j in l:
            mp2 += 10
            added += j
            mini[0].append(j)
            d = abs(i - added)
            if d <= mini[2]:
                mini[1] = i
                mini[2] = d
                mini[3] = mp2
                if added > i:
                    for k in l:
                        added -= k
                        d = abs(i - added)
                        if d <= mini[2]:
                            mp2 -= 10
                            mini[0].remove(k)
                            mini[1] = i
                            mini[2] = d
                            mini[3] = mp2
                        else:
                            break
            elif added > i + 10:
                break
        get2.append(mini)
    get3 = [[],[],[],[]]
    for ii in get2:
        if ii[1] == 0:
            break
        else:
            get3[0].append(ii[0])
            get3[1].append(ii[1])
            get3[2].append(ii[2])
            get3[3].append(ii[3])
    index = get3[2].index(min(get3[2]))
    for i in get3[0][index]:
        l.remove(i)
    take.remove(get3[1][index])
    mp += get3[2][index] + get3[3][index]

if len(take) != 0:
    add_take()

print("{}".format(mp))
