let () =
  Scanf.scanf "%d %d" @@ fun n m ->
  let ab = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun x y -> x, y)) in
  Array.sort compare ab;
  Array.fold_left (fun (c, t) (a, b) ->
    if t >= m then (c, t)
    else
    let d = min (m - t) b in
    (c + a * d, t + d)) (0, 0) ab
  |> fst |> Printf.printf "%d\n"
