import bisect
import itertools

n, a, b, c = map(int, input().split())
l = sorted([int(input()) for i in range(n)])
ABC = [a, b, c]
ans = float("inf")

def dfs(i, abc):
    global ans
    sum_a = 0
    l1 = l[:]
    if i == 3:
        for k in itertools.permutations([0, 1, 2], 3):
            for j in k:
                index = bisect.bisect_left(l1, ABC[j])
                if abc[j] == 0:
                    if index < len(l1):
                        sum_a += l1[index] - ABC[j]
                        l1.remove(l1[index])
                    else:
                        sum_a += float("inf")
                elif abc[j] == 1:
                    if index > 0:
                        sum_a += ABC[j] - l1[index - 1]
                        l1.remove(l1[index - 1])
                    else:
                        sum_a += float("inf")
                else:
                    sum_ = float("inf")
                    for x in range(2, len(l1) + 1):
                        for y in itertools.combinations(l1, x):
                            if sum_ > abs(sum(y) - ABC[j]):
                                sum_ = abs(sum(y) - ABC[j]) + (x - 1) * 10
                                l2 = l1[:]
                                for z in y:
                                    l2.remove(z)
                    l1 = l2[:]
                    sum_a += sum_
            ans = min(ans, sum_a)
        return 0
    dfs(i + 1, abc[:i] + [abc[i]] + abc[i + 1:])
    dfs(i + 1, abc[:i] + [abc[i] + 1] + abc[i + 1:])
    dfs(i + 1, abc[:i] + [abc[i] + 2] + abc[i + 1:])

dfs(0, [0, 0, 0])
print(ans)