
{-# LANGUAGE UnboxedTuples #-}

import qualified Data.ByteString.Char8 as B
import Data.Char (isSpace)
import Data.List (unfoldr)

readInt = B.readInt . B.dropWhile isSpace
readInts = unfoldr readInt

inf = 10000

a#b = abs (a-b)


solv :: Int -> Int -> Int -> [Int] -> Int
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] <- readInts <$> B.getLine
  ls <- readInts <$> B.getContents
  print $ solv a b c ls
