n, a, b, c = map(int, input().split())
l = sorted([int(input()) for i in range(n)])
mp = 0
for goal in [c, a, b]: #条件が厳しい順に作っていく
    tem_mp = 10**10
    used = []
    for bit in range(1, 2 ** len(l)): #何も使わないものを除く
        length = 0
        cost = 0
        count = 0
        tem_used = []
        for j in range(len(l)):
            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.pop(u)

print(mp)