let simplify_dist d =
let h = Hashtbl.create 10 in
let add_entry (x, p) =
try
let p1 = Hashtbl.find h x in
Hashtbl.replace h x (p +. p1)
with Not_found -> Hashtbl.add h x p in
let hash_to_list h =
let f k d rest = (k,d)::rest in
Hashtbl.fold f h [] in
List.iter add_entry d;
hash_to_list h