let rec buy m lst = match lst with
  | [] -> 0
  | (x, y) :: tail ->
    if m <= y then x * m
    else x * y + buy (m-y) tail
let () =
  let (n, m) = Scanf.scanf "%d %d\n" (fun x y -> (x, y)) in
  let lst = List.fast_sort (fun (a, _) (b, _) -> if a > b then 1 else if a < b then -1 else 0) (Array.to_list (Array.init n (fun _ -> Scanf.scanf "%d %d\n" (fun x y -> (x, y))))) in
  Printf.printf "%d\n" (buy m lst)