n,a,b,c=map(int,input().split())
length=[]
for i in range(n):
  k=int(input())
  length.append(k)
length=sorted(length)
x=[0,1,2,3]
ans=[]
for p in x:
  for q in x:
    for r in x:
      for s in x:
        for t in x:
          for u in x:
            for v in x:
              for w in x:
                value=0
                a_length=0
                b_length=0
                c_length=0
                line=[p,q,r,s,t,u,v,w]
                line.count(1)>1:
                  value+=10*line.count(1)
                line.count(2)>1:
                  value+=10*line.count(1)
                line.count(3)>1:
                  value+=10*line.count(1)
                A=[i for i, y in enumerate(length) if y ==1]
                B=[i for i, y in enumerate(length) if y ==2]
                C=[i for i, y in enumerate(length) if y ==3]
                for i in A:
                  a_length+=length[i]
                for i in B:
                  b_length+=length[i]
                for i in C:
                  c_length+=length[i]
                value+=abs(a-a_length)
                value+=abs(b-b_length)
                value+=abs(c-c_length)
                ans.append(value)
print(min(ans))
                