let input () =
let (n,m) = Scanf.sscanf (read_line ()) "%d %d" (fun a b -> (a,b)) in
let rec loop count list =
  match count with
    0 -> list
  | x -> let (a,b) = Scanf.sscanf (read_line ()) "%d %d" (fun a b -> (a,b)) in
          loop (count - 1) ((a,b)::list)
in (m,loop n []);;

let solve () =
  let (m, list) = input() in
  let sort_list = List.sort (fun (a,_) (b,_) -> if a > b then 1 else -1) list in
  let rec loop ans m l =
    let (a,b) = List.hd l in
    if m > b then
      loop (ans + (a*b)) (m-b) (List.tl l)
    else print_int (ans + m*a)
  in loop 0 m sort_list;;

solve();;