from collections import Counter
import itertools
N,A,B,C=map(int,input().split())
l=[]
for i in range(N):
  l.append(int(input()))
ans=float('inf')
for item in itertools.product(range(4),repeat=N):
  c=Counter(item)
  if c[0]==0 or c[1]==0 or c[2]==0:
    continue
  d=[0,0,0,0]
  for i in range(N):
    d[item[i]]+=l[i]
  kans=(abs(A-d[0])+abs(B-d[1])+abs(C-d[2])+10*(c[0]+c[1]+c[2]-3))
  ans=min(ans,kans)
print(ans)