import sys
from copy import deepcopy
def input(): return sys.stdin.readline().strip()

"""
この関数、xxxxxxxxxをaaabbbcccやaabbbbbbcみたいに分けるのには使えるけど
abcabcabcみたいに入り混じった場合が出てこないからだめだ。。。

def func(n): # 和がnになるような３つの数字の組を全列挙
    arr = []
    for i in range(1, n - 1):
        for j in range(1, n - i):
            arr.append((i, j, (n - i - j)))
    return arr
"""

def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

def main():
    N, A, B, C = map(int, input().split())
    L = [int(input()) for _ in range(N)]

    """
    どの竹をくっつけるかをビット全探索
    """

    ans = 10**100
    for n in range(1 << N):
        bumboo_num = [i for i in range(N) if n & (1 << i)] # まずは使う竹の選別
        l = len(bumboo_num)
        for i in range(3 **l): # 各竹をA, B, Cのどれに振り分けるかの3^l通りを試すべきだった
            near_a = 0
            near_b = 0
            near_c = 0
            p = 0
            q = 0
            r = 0
            x = base10to(i, 3)
            l_x = len(x)
            for j in range(l):
                if l_x - j - 1 < 0 or x[l_x - j - 1] == '0':
                    p += 1
                    near_a += L[bumboo_num[j]]
                elif l_x - j - 1 < 0 or x[l_x - j - 1] == '1':
                    q += 1
                    near_b += L[bumboo_num[j]]
                elif l_x - j - 1 < 0 or x[l_x - j - 1] == '2':
                    r += 1
                    near_c += L[bumboo_num[j]]
            if p == 0 or q == 0 or r == 0: continue
            val = 10 * (p - 1 + q - 1 + r - 1)
            val1 = val + abs(A - near_a) + abs(B - near_b) + abs(C - near_c)
            #if ans > val1: print("n={}, p={}, q={}, r={}, val={}".format(bin(n)[2:], p, q, r, val1))
            ans = min(ans, val1)
            val2 = val + abs(A - near_a) + abs(C - near_b) + abs(B - near_c)
            #if ans > val2: print("n={}, p={}, q={}, r={}, val={}".format(bin(n)[2:], p, r, q, val2))
            ans = min(ans, val2)
            val3 = val + abs(B - near_a) + abs(A - near_b) + abs(C - near_c)
            #if ans > val3: print("n={}, p={}, q={}, r={}, val={}".format(bin(n)[2:], q, p, r, val3))
            ans = min(ans, val3)
            val4 = val + abs(B - near_a) + abs(C - near_b) + abs(A - near_c)
            #if ans > val4: print("n={}, p={}, q={}, r={}, val={}".format(bin(n)[2:], r, p, q, val4))
            ans = min(ans, val4)
            val5 = val + abs(C - near_a) + abs(A - near_b) + abs(B - near_c)
            #if ans > val5: print("n={}, p={}, q={}, r={}, val={}".format(bin(n)[2:], q, r, p, val5))
            ans = min(ans, val5)
            val6 = val + abs(C - near_a) + abs(B - near_b) + abs(A - near_c)
            #if ans > val6: print("n={}, p={}, q={}, r={}, val={}".format(bin(n)[2:], r, q, p, val6))
            ans = min(ans, val6)
    print(ans)




if __name__ == "__main__":
    main()
