import           Control.Monad
import           Control.Applicative
import           Data.List
import qualified Data.Vector                   as V

getBysplit = map read . words <$> getLine

main :: IO ()
main = do
  [n, a, b, c] <- getBysplit :: IO [Int]
  l            <- replicateM n readLn :: IO [Int]
  let vec = V.fromList l
  print $ dfs vec (a, b, c) (n - 1) (0, 0, 0)


dfs :: V.Vector Int -> (Int, Int, Int) -> Int -> (Int, Int, Int) -> Int
dfs vec (a1, b1, c1) cur (a, b, c) = if cur == -1
  then if minimum [a, b, c] > 0
    then abs (a - a1) + abs (b - b1) + abs (c - c1) - 30
    else 10000000000000
  else
    let ret0 = dfs vec (a1, b1, c1) (cur - 1) (a, b, c)
        ret1 = dfs vec (a1, b1, c1) (cur - 1) ((a + vec V.! cur), b, c) + 10
        ret2 = dfs vec (a1, b1, c1) (cur - 1) (a, (b + vec V.! cur), c) + 10
        ret3 = dfs vec (a1, b1, c1) (cur - 1) (a, b, (c + vec V.! cur)) + 10
    in  minimum [ret0, ret1, ret2, ret3]
