n, a, b, c = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))
from itertools import product
bamboo = [0, a, b, c]
min_num = float('inf')
for i in product([0, 1, 2, 3], repeat=n):
    if set(i) >= set([1, 2, 3]):
        sums = [0, 0, 0, 0]
        tmp = -30
        for j in range(n):
            if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
        min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4)))
print(min_num) n, a, b, c = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split a b c l = [] l [] for i in range(n):
    l.append(int(input())) i range(n) range n l.append(int(input())) l.append l append int(input()) int input() input from itertools import product bamboo = [0, a, b, c] bamboo [0, a, b, c] 0 a b c min_num = float('inf') min_num float('inf') float 'inf' for i in product([0, 1, 2, 3], repeat=n):
    if set(i) >= set([1, 2, 3]):
        sums = [0, 0, 0, 0]
        tmp = -30
        for j in range(n):
            if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
        min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4))) i product([0, 1, 2, 3], repeat=n) product [0, 1, 2, 3] 0 1 2 3 repeat=n repeat n if set(i) >= set([1, 2, 3]):
        sums = [0, 0, 0, 0]
        tmp = -30
        for j in range(n):
            if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
        min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4))) set(i) >= set([1, 2, 3]) set(i) set i set([1, 2, 3]) set [1, 2, 3] 1 2 3 sums = [0, 0, 0, 0] sums [0, 0, 0, 0] 0 0 0 0 tmp = -30 tmp -30 for j in range(n):
            if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
         j range(n) range n if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
         i[j] != 0 i[j] i j 0 sums[i[j]] += l[j] sums[i[j]] sums i[j] i j l[j] l j tmp += 10 tmp 10 min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4))) min_num min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4))) min min_num tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4)) tmp sum(abs(sums[k] - bamboo[k]) for k in range(1, 4)) sum abs(sums[k] - bamboo[k]) abs sums[k] - bamboo[k] sums[k] sums k bamboo[k] bamboo k print(min_num) print min_num l = [] [] l n, a, b, c = map(int, input().split()) map(int, input().split()) n bamboo = [0, a, b, c] [0, a, b, c] bamboo min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4))) min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4))) min_num a, b, c = map(int, input().split()) map(int, input().split()) a min_num = float('inf') float('inf') min_num tmp += 10 10 tmp tmp = -30 -30 tmp b, c = map(int, input().split()) map(int, input().split()) b c = map(int, input().split()) map(int, input().split()) c sums = [0, 0, 0, 0] [0, 0, 0, 0] sums
n, a, b, c = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))
from itertools import product
bamboo = [0, a, b, c]
min_num = float('inf')
for i in product([0, 1, 2, 3], repeat=n):
    if set(i) >= set([1, 2, 3]):
        sums = [0, 0, 0, 0]
        tmp = -30
        for j in range(n):
            if i[j] != 0:
                sums[i[j]] += l[j]
                tmp += 10
        min_num = min(min_num,tmp+sum(abs(sums[k] - bamboo[k]) for k in range(1, 4)))
print(min_num)