Scanf.scanf "%d %d %d" (fun n a b ->
    let x = Array.init n (fun _ -> Scanf.scanf " %d" (fun x ->x)) in

    let rec loop i acc =
        if i = n then acc else
            loop (i + 1) (acc + min (a * (x.(i) - x.(i - 1))) b)
    in
    loop 1 0 |> Printf.printf "%d\n"
)