{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad (replicateM)

main :: IO ()
main = do
  [n, a, b, c] <- map read . words <$> getLine
  ls <- replicateM n readLn
  print $ solve n a b c ls

solve :: Int -> Int -> Int -> Int -> [Int] -> Int
solve _ a b c = minimum . dfs 0 0 0
  where
    dfs x y z []
      | x == 0 || y == 0 || z == 0 = []
      | otherwise = [abs (x - a) + abs (y - b) + abs (z - c) - 30]
    dfs x y z (l:ls) = d1 <> d2 <> d3 <> d4
      where
        d1 = dfs x y z ls
        d2 = map (+ 10) $ dfs (x + l) y z ls
        d3 = map (+ 10) $ dfs x (y + l) z ls
        d4 = map (+ 10) $ dfs x y (z + l) ls
