from itertools import product as p
N,A,B,C=map(int,input().split())
l=[int(input()) for _ in range(N)]

ans=10**12

for i in p(range(4),repeat=N):
  if not (i.count(1)>=1 and i.count(2)>=1 and i.count(3)>=1):continue
  a,b,c=0,0,0
  cost=0
  tt=N-i.count(0)

  for (k,j) in enumerate(i):
    if j==1:a+=l[k]
    elif j==2:b+=l[k]
    elif j==3:c+=l[k]
  
  cost=abs(a-A)+abs(b-B)+abs(c-C)
  cost+=10*(tt-3)

  ans=min(ans,cost)

print(ans)