n, a, b, c = list(map(int, input().split(' ')))
l = []
d = {'a': a, 'b': b, 'c': c}
for i in range(n):
    l.append(int(input()))
l = sorted(l)[::-1]
seed = {
	3: [[1,1,1]],
	4: [[1,1,2], [1,2,1], [2,1,1]], # mp=10
	5: [[1,1,3], [1,3,1], [3,1,1],  # mp=20
        [1,2,2], [2,1,2], [2,2,1]],
	6: [[1,1,4], [1,4,1], [4,1,1],  # mp=30
        [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1],
        [2,2,2]],
	7: [[1,1,5], [1,5,1], [5,1,1],  # mp=40
        [1,2,4], [1,4,2], [2,1,4], [2,4,1], [4,1,2], [4,2,1],
        [1,3,3], [3,1,3], [3,3,1],
        [2,2,3], [2,3,2], [3,2,2]],
	8: [[1,1,6], [1,6,1], [6,1,1],  # mp=50
        [1,2,5], [1,5,2], [2,1,5], [2,5,1], [5,1,2], [5,2,1],
        [1,3,4], [1,4,3], [3,1,4], [3,4,1], [4,1,3], [4,3,1],
        [2,2,4], [2,4,2], [4,2,2],
        [2,3,3], [3,2,3], [3,3,2]],
}
ans = 9999999

def next(ch):
    return 'b' if ch == 'a' else 'c' if ch == 'b' else 'd'
abc = ['a', 'b', 'c']
min_a = 9999999
memo = {}
def f(index, current_ch, sss, used, costs):
    global min_a
    sumsum = abs(sum(costs['a']) - a) + abs(sum(costs['b']) - b) + abs(sum(costs['c']) - c)
    key = str((index, current_ch, sss, used, sumsum))
    if key in memo:
        return memo[key]
    
    if costs['a'] and current_ch == 'b':
        if min_a >= abs(sum(costs['a']) - a):
            min_a = abs(sum(costs['a']) - a)
        elif min_a < abs(sum(costs['a']) - a) * 0.1:
            return 9999999

    if current_ch == 'd':
        memo[key] = sumsum
        return memo[key]
    # if index >= n or n-index < sss[abc.index(current_ch)] - len(costs[current_ch]) + (2-abc.index(current_ch)):
    if index >= n:
        # print ('hoge', sss, costs, n, index, current_ch)
        memo[key] = 9999999
        return memo[key]
    # skip
    temp = min(9999999, f(index+1, current_ch, sss, used, costs))
    # 1つ追加
    tugihe = len(costs[current_ch]) == sss[abc.index(current_ch)] - 1
    next_ch = next(current_ch) if tugihe else current_ch
    next_index = 0 if tugihe else index + 1
    for i in range(index, n):
        if used[i]:
            continue
        used[i] = True
        costs[current_ch].append(l[i])
        temp = min(temp, f(next_index, next_ch, sss, used, costs))
        used[i] = False
        costs[current_ch].pop(len(costs[current_ch])-1)
    memo[key] = temp
    return memo[key]

for k in range(3, n+1):
  mp = (k - 3) * 10
  used = [False] * n
  for seed_k_j in seed[k]:
      hoge = f(0, 'a', seed_k_j, used, {'a':[], 'b':[], 'c':[]}) + mp
    #   if hoge < 9999999:
    #       print (hoge, seed_k_j)
      ans = min(ans, hoge)
print(ans)