n,a,b,c=[int(i) for i in input().split()]
ts = [a,b,c]
ls = []
for _ in range(n):
    ls.append(int(input()))
r = 10**18
for i in range(4**n):
    xs = [[] for _ in range(4)]
    for j in range(n):
        k, i = i%4, i//4
        xs[k].append(ls[j])
    ir = 0
    for l in range(3):
        if len(xs[l]) == 0:
            ir = 10 ** 18
            break
        ir += 10*(len(xs[l])-1) + abs(ts[l]-sum(xs[l]))
    r = min(r, ir)
print(r)
