import           Control.Monad
import           Data.Maybe
import qualified Data.ByteString.Char8         as C8

inf :: Int
inf = 100000

getInt :: IO Int
getInt = fmap (fst . fromJust . C8.readInt) C8.getLine

getInts :: IO [Int]
getInts = fmap (map (fst . fromJust . C8.readInt) . C8.words) C8.getLine

main :: IO ()
main = do
    [n, a, b, c] <- getInts
    ls           <- replicateM n $ getInt
    print $ solve ls [0, 0, 0] [a, b, c]

solve :: [Int] -> [Int] -> [Int] -> Int
solve [] xs as = if product xs == 0
    then inf
    else subtract 30 . sum . zipWith (\s t -> abs (s - t)) xs $ as

solve (l : ls) [x, y, z] as = minimum
    [ solve ls [x, y, z] as
    , 10 + solve ls [x + l, y, z] as
    , 10 + solve ls [x, y + l, z] as
    , 10 + solve ls [x, y, z + l] as
    ]
solve _ _ _ = 0
