import sys
import collections

sys.setrecursionlimit(100000)

n, a, b, c = map(int, input().split())
l = []

ans = 999999999999

for i in range(n):
    l.append(int(input()))


def calc_mp(ml):
    res = [0] * 4
    for i in range(n):
        res[ml[i]] += l[i]

    cc = collections.Counter(ml)
    mp = (max(cc[0]-1, 0) + max(cc[1]-1, 0) + max(cc[2]-1, 0)) * 10
    return mp + abs(res[0] - a) + abs(res[1] - b) + abs(res[2] - c)


def calc(ml, k):
    if k == n:
        return calc_mp(ml)
    return min(calc(ml + [0], k + 1), calc(ml + [1], k + 1), calc(ml + [2], k + 1), calc(ml + [3], k + 1))


print(calc([], 0))
