  
n,a,b,c = map(int,input().split())

orgPetternList =[]
def petternMake(cnt,s):
  if cnt == n+1:
    orgPetternList.append(s)
    return
  for i in range(4):
    petternMake(cnt+1,s+str(i))
  

banboo = [int(input()) for i in range(n)]

#全部一度全パターンで足しきる場合の回す元リスト作成
petternMake(1,'')

min = 999999999
#全パターンループして、最低MP算出
for ptn in orgPetternList:
  ptnList = list(ptn)
  sumMp = 0
  nowa =0
  nowb =0
  nowc =0
  for cnt in range(len(ptnList)):	
    if ptnList[cnt] == '1':
      nowa += banboo[cnt]
      sumMp +=10
    elif ptnList[cnt]=='2':
      nowb += banboo[cnt]
      sumMp +=10
    elif ptnList[cnt]=='3':
      nowc += banboo[cnt]
      sumMp +=10
  sumMp = sumMp + abs(a-nowa) + abs(b-nowb) +abs(c-nowc)

  if sumMp < min:    
    min = sumMp

print(min)