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

for i in range(N):
    l.append(int(input()))


def gen_pat(n, pat):
    if n==0:
        return [pat]
    out = []
    for s in list("ABC0"):
        out += gen_pat(n-1, pat+s)
    return out

def cal(l, x):
    return 10*(len(l)-1)+abs(sum(l)-x)

cost = 10000000000000
for p in gen_pat(len(l), ""):
    a = [l[i] for i in range(len(l)) if p[i]=="A"]
    b = [l[i] for i in range(len(l)) if p[i]=="B"]
    c = [l[i] for i in range(len(l)) if p[i]=="C"]
    if len(a)==0 or len(b)==0 or len(c)==0:
        continue

    cost = min(cost,
               cal(a, A)+cal(b, B)+cal(c, C))

print(cost)
