import Control.Monad (replicateM)
import Data.List (sort)

main :: IO ()
main = do
  (n, m) <- readPair
  abs <- replicateM n readPair
  print $ solve m abs

readPair :: IO (Int, Int)
readPair = do
  [x, y] <- map read . words <$> getLine
  return (x, y)

solve :: Int -> [(Int, Int)] -> Int
solve m xys = go m $ sort xys
  where
    go m ((x, y) : xys)
      | m > y     = x * y + go (m - y) xys
      | otherwise = x * m