import math

def d2n(d, n, p):
    x = '' # Output
    while d > 0:
        x = str(d % n) + x
        d = int(d / n)
    return x.zfill(p)

def divide(l, n):
    x = [[], [], []] # 追加していく
    for i, j in enumerate(n):
        x[int(j)].append(l[i])
    return x

def minimum(l, ABC):
    mp = math.inf
    c = 1
    while c < 2 ** len(l):
        n = d2n(c, 2, len(l)) # 選ぶ竹を集める
        m = []
        for i, j in enumerate(n):
            if j == "1":
                m.append(l[i])
        if abs(ABC - sum(m)) + (len(m) - 1) * 10 < mp:
            mp = abs(ABC - sum(m)) + (len(m) - 1) * 10
        c += 1 
    return mp

N, A, B, C = map(int, input().split())

l = []
for _ in range(N):
    l.append(int(input()))

c = 0 
mp = math.inf
while c < 3 ** N:
    n = d2n(c, 3, N) # グループわけ
    l1, l2, l3 = divide(l, n)
    if len(l1) != 0 and len(l2) != 0 and len(l3) != 0: # 各リストの要素を使った最小値を計算
        a = minimum(l1, A) + minimum(l2, B) + minimum(l3, C)
        if a < mp:
            mp = a    
    c += 1

print(mp)