import           Control.Monad
import           Data.List

main :: IO ()
main = do
    [n, m] <- fmap (map read . words) getLine :: IO [Int]
    cs     <- replicateM n $ fmap (map read . words) getLine :: IO [[Int]]
    print . solve m $ cs

solve :: Int -> [[Int]] -> Int
solve m cs = purchase m scs where scs = sort . map (\[a, b] -> (a, b)) $ cs

purchase :: Int -> [(Int, Int)] -> Int
purchase m ((a, b) : cs) =
    if m <= b then m * a else a * b + purchase (m - b) cs
purchase _ [] = 0
