N,a,b,c=map(int,input().split())
l=[int(input()) for _ in range(N)]

ans=[]
for i in range(4**N):
  A=[]
  B=[]
  C=[]
  p=i
  for j in range(N):
    if p%4==1:
      A.append(l[j])
    elif p%4==2:
      B.append(l[j])
    elif p%4==3:
      C.append(l[j])
    p=(p-p%4)//4
  if len(A)>0 and len(B)>0 and len(C)>0:
    ans.append(abs(sum(A)-a)+10*(len(A)-1)+abs(sum(B)-b)+10*(len(B)-1)+abs(sum(C)-c)+10*(len(C)-1))
    
print(min(ans))
