let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ab_s = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let f (y, c) (a, b) =
  if c + b >= m then ((m - c) * a + y |> Printf.printf "%d\n"; exit 0);
  y + b * a, c + b
let _ =
  Array.sort compare ab_s;
  Array.fold_left f (0, 0) ab_s