def Base_10_to_n(x,n):
  tmp=x
  out=''
  while tmp>0:
    out=str(tmp%n)+out
    tmp=int(tmp/n)
  return out
n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=10**18
for i in range(4**n):
  cost=0
  d=[[] for i in range(4)]
  s=Base_10_to_n(i,4).zfill(n)
  for j in range(n):
    k=int(s[j])
    d[k].append(l[j])
  if len(d[1])*len(d[2])*len(d[3])==0:
    continue
  for i in range(1,4):
    cost+=(len(d[k])-1)*10
  d1=sum(d[1])
  d2=sum(d[2])
  d3=sum(d[3])
  l=[abs(d1-a)+abs(d2-b)+abs(d3-c),abs(d1-a)+abs(d2-c)+abs(d3-b),abs(d1-b)+abs(d2-a)+abs(d3-c),abs(d1-b)+abs(d2-c)+abs(d3-a),abs(d1-c)+abs(d2-a)+abs(d3-b),abs(d1-c)+abs(d2-b)+abs(d3-a)]
  cost=min(l)
  ans=min(ans,cost)
print(ans)