N,A,B,C = map(int, input().split())
L = [A,B,C]
l = []       
for n in range(N):
    l.append(int(input()))

mp = []
for i in range(4**N):
    Test = [0,0,0]
    MP = 0
    for j in range(N):
        n = i%4
        if n < 3:
            MP += 10 if Test[n] else 0
            Test[n] += l[j]
        i >>= 2
    for i in range(3):
        MP += abs(L[i]-Test[i]) if Test[i] else 3000
    mp.append(MP)

print(min(mp))