n, a, b, c = map(int, input().split())
l = sorted([int(input()) for i in range(n)])
ans = 10**10
for order in [[a, b, c],[b, c, a],[c, a, b],[a, c, b],[b, a, c],[c, b, a]]:
    mp = 0
    l_copy = l.copy()
    for goal in order:
        tem_mp = 10**10
        used = []
        for bit in range(1, 2 ** len(l_copy)):
            length = 0
            cost = 0
            count = 0
            tem_used = []
            for j in range(len(l_copy)):
                if (bit >> j) & 1:
                    length += l[j]
                    count += 1
                    if count > 1:
                        cost += 10
                    tem_used.append(j)
            if tem_mp  > abs(goal - length) + cost:
                used = tem_used
                tem_mp = abs(goal - length) + cost
        mp += tem_mp
        for u in used[::-1]:
            l_copy.pop(u)
    ans = min(ans, mp)

print(ans)