import Control.Applicative
import Control.Monad
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = do
  [n, m] <- f
  solve m <$> (sort <$> replicateM n f) >>= print
  where
    f = readil B.readInt <$> B.getLine

solve :: Int -> [[Int]] -> Int
solve m abs = f 0 m abs
  where
    f tm 0 _ = tm
    f tm nd ([a, b]:xs) = let n = min nd b
                          in f (tm + a * n) (nd - n) xs

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr $ \s -> do
  (n, s') <- f s
  return (n, B.dropWhile isSpace s')
