n,a,b,c = map(int,input().split())
l=[int(input()) for i in range(n)]
l.sort()
answer  = 10*100
for i in range(1,2**(2*n)):
    a_u = []
    b_u = []
    c_u = []
    ans = 0
    j = i
    counte = 0
    while counte < n:
        if j%4 == 1:
            a_u.append(l[counte])
        if j%4 == 2:
            b_u.append(l[counte])
        if j%4 == 3:
            c_u.append(l[counte])
        j = j//4
        counte += 1
    ans += abs(sum(a_u)-a) + 10*(len(a_u)-1)
    ans += abs(sum(b_u)-b) + 10*(len(b_u)-1)
    ans += abs(sum(c_u)-c) + 10*(len(c_u)-1)
    answer = min(ans,answer)

print(answer)