# -*- 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 = []
for i in get[3]:
    ind.append(i.index(min(get3[2])))
    get[3].remove(i)
    if len(ind) == 3:
        break
for i in ind:
    l.remove(get3[0][i])
    take.remove(get3[1][i])
    mp += get3[2][i]

for i in take:
    added = 0
    mp2 = 0
    mini = [[], 0, 10]
    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
            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
                    else:
                        break
        elif added > i + 10:
            break
    for m in mini[0]:
        l.remove(m)
    take.remove(mini[1])
    mp += mini[2] + mp2

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