
{-# LANGUAGE UnboxedTuples #-}

inf = 10000

a#b = abs (a-b)

solv a b c ls = go ls (# 0,0,0 #) 0 where
  go [] tp cost = case tp of
    (# la, lb, lc #)
      | la==0 || lb==0 || lc==0 -> inf
      | otherwise -> cost + a#la + b#lb + c#lc
  go (l:ls) tp cost = case tp of
    (# la, lb, lc #) ->
      let forA = go ls (# la+l, lb, lc #) $ if la>0 then cost+10 else cost
          forB = go ls (# la, lb+l, lc #) $ if lb>0 then cost+10 else cost
          forC = go ls (# la, lb, lc+l #) $ if lc>0 then cost+10 else cost
          unuse = go ls (# la,lb,lc #) cost
      in minimum [forA, forB, forC, unuse]
    
main = do
  [n,a,b,c] <- map read . words <$> getLine
  ls <- map read . words <$> getContents
  print $ solv a b c ls
