import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Char
import Data.List

type Query = (Int, Int, Int)
type Sta = (Int, Int, Int, Int)

main :: IO ()
main = do
    [d, g] <- readInts
    [ps, cs] <- transpose <$> replicateM d readInts
    print $ solve d g ps cs

readInts :: IO [Int]
readInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

solve :: Int -> Int -> [Int] -> [Int] -> Int
solve d g ps cs
    = head
    $ sort
    $ map (\(x, _, _, _) -> x)
    $ map (addRem g)
    $ filter (reach g)
    $ filter (\(_, _, i, _) -> i > 0)
    $ foldM select (0, 0, 0, 0) (zip3 [1..d] ps cs)

reach :: Int -> Sta -> Bool
reach g (_, s, i0, p0) = (p0 - 1) >= q && q >= 0
    where q = (g - s) `div` (100 * i0)

addRem :: Int -> Sta -> Sta
addRem g (n, s, i0, p0) = (n + q, s + 100 * i0 * q, i0, p0)
    where q = (g - s) `div` (100 * i0)

select :: Sta -> Query -> [Sta]
select (n, s, i0, p0) (i, p, c) =
    [ (n + p, s + 100 * i * p + c, i0, p0)
    , (n, s, i, p)
    ]