import copy

n, a, b, c = list(map(int, input().split(" ")))
l = n*[0]
for i in range(n):
    l[i] = int(input())



def search(abc, l):
    mp = 0
    for x in abc:
        if(x in l): l[l.index(x)] = 0
        else:
            while(True):
                k = 1e9
                d = -1
                for i in range(n):
                    if(l[i] == 0): continue

                    if(abs(x - l[i]) < k):
                        k = abs(x - l[i])
                        d = i

                if(k <= 10):
                    mp += k
                    l[d] = 0
                    break
                else:
                    tmp2 = [k, d]
                    k = 1e9
                    d = -1
                    for i in range(n):
                        if(l[i] == 0): continue
                        for j in range(i+1, n, 1):
                            if(l[j] == 0): continue

                            if(abs(x - (l[i]+l[j])) < k and abs(x - (l[i]+l[j])) < abs(x - l[i]) and abs(x - (l[i]+l[j])) < abs(x - l[j])):
                                k = abs(x - (l[i]+l[j]))
                                d = [i, j]

                    if(k != 1e9):
                        l[d[0]] += l[d[1]]
                        l[d[1]] = 0
                        mp += 10
                    else:
                        mp += tmp2[0]
                        l[tmp2[1]] = 0
                        break

    return mp

ans = []
ans.append(search([a, b, c], copy.deepcopy(l)))
ans.append(search([a, c, b], copy.deepcopy(l)))
ans.append(search([b, a, c], copy.deepcopy(l)))
ans.append(search([b, c, a], copy.deepcopy(l)))
ans.append(search([c, a, b], copy.deepcopy(l)))
ans.append(search([c, b, a], copy.deepcopy(l)))


print(min(ans))