let d_merge a b = if ((snd a) mod (fst b)) = 0 then (fst a, snd b) else raise (Beam_Matching_Error "merge")