import Control.Monad
import Data.Bits
import Data.List
import Debug.Trace

inf :: Int
inf = 10^5

listToTuple :: Int -> [Int] -> (Int, Int, Int)
listToTuple x [a,b] = (a, x*100, b)

solve :: [(Int, Int, Int)] -> Int -> Int -> Int
solve pcs g i = minimum $ [l | j <- [0..i], let l = loop pcs g j [], l<inf]
    where
        loop :: [(Int, Int, Int)] -> Int -> Int -> [Int] -> Int
        loop [] g i keep = loop2 (reverse $ sort keep) g
        loop ((a,base,complete):pcs) g i keep
            | g <= 0 = 0
            | i .&. 1 == 1 = a + loop pcs (g-a*base-complete) (shiftR i 1) keep
            | otherwise = loop pcs g (shiftR i 1) ((replicate (a-1) base) ++ keep)
        
        loop2 :: [Int] -> Int -> Int
        loop2 [] g
            | g <= 0 = 0
            | otherwise = inf
        loop2 (x:xs) g
            | g <= 0 = 0
            | otherwise = 1 + loop2 xs (g-x)

main = do
    [d,g] <- map read . words <$> getLine :: IO [Int]
    pcs <- forM [1..d] $ \i -> listToTuple i . map read . words <$> getLine
    print $ solve pcs g (2^d-1)