from itertools import*
n,a,b,c,*l=map(int,open(0).read().split())
a=a,b,c
m=10**18
for s in product(*[range(4)]*n):
  if all(i in s for i in(0,1,2)):
    t,c=[0]*4,[0]*4
    for i,v in zip(s,l):
      t[i]+=v
      c[i]+=1
    m=min(m,sum(abs(x-y)+~-z*10for x,y,z in zip(a,t,c)))
print(m)