import Control.Applicative
import Control.Monad
import Data.List
import Data.Array

main = do
  [n, m] <- map (read::String -> Int) . words <$> getLine
  arr <- sort <$> forM [1..n] (\i -> do
    [a, b] <- map (read::String -> Int) . words <$> getLine
    return (a, b))
  print . fst $ foldl (\(sumCost, sumDrink) (cost, maxDrink) -> 
    let numDrink = min (m - sumDrink) maxDrink
    in (sumCost + numDrink * cost, sumDrink + numDrink)) (0, 0) arr
  