N,A,B,C=map(int,input().split())
l=[int(input()) for i in range(N)]
INF=10**9

def bamboo(count,a,b,c):
  if count==N:
    if min(a,b,c)>0:
      return abs(a-A)+abs(b-B)+abs(c-C)-30
    else:
      return INF
  rot0=bamboo(count+1,a,b,c)
  rot1=bamboo(count+1,a+l[count],b,c)+10
  rot2=bamboo(count+1,a,b+l[count],c)+10
  rot3=bamboo(count+1,a,b,c+l[count])+10
  return min(rot0,rot1,rot2,rot3)
print(bamboo(0,0,0,0))