open Printf open Scanf
open Array

let () = scanf " %d %d" @@ fun n m ->
  let a = init n (fun _ -> scanf " %d %d" @@ fun u v -> u,v) in
  sort compare a;
  fold_left (fun (sum,left) (v,k) ->
    if k >= left then (
      print_int @@ sum + v * left; exit 0
    ) else (
      (sum+v*k,left-k)
    )
  ) (0,m) a |> ignore