let rec f lst oklst = match lst with | [] -> List.length oklst | first :: rest -> if List.mem first oklst then f rest oklst else f rest (first :: oklst) let () = let p1, p2 = Scanf.scanf "%d\n%d\n" (fun a b -> a,b) in let n = Scanf.scanf "%d\n" (fun x -> x) in let lst = Array.to_list (Array.init n (fun _ -> Scanf.scanf "%d\n" (fun x -> x))) in Printf.printf "%d\n" ((n - (f lst [])) * (p1 + p2))