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

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 main():
    N, A, B, C = map(int, input().split())
    L = []
    for _ in range(N):
        L.append(int(input()))

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

    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 p, q, r in func(l):
            near_a = 0
            near_b = 0
            near_c = 0
            for i in range(p): near_a += L[bumboo_num[i]]
            for i in range(p, p + q): near_b += L[bumboo_num[i]]
            for i in range(p + q, l): near_c += L[bumboo_num[i]]
            val = 10 * (max(0, p - 1) + max(0, q - 1) + max(0, r - 1))
            val += abs(A - near_a) + abs(B - near_b) + abs(C - near_c)
            #if ans > val: print("n={}, p={}, q={}, r={}".format(n, p, q, r))
            ans = min(ans, val)
    print(ans)




if __name__ == "__main__":
    main()
