Reaction with unsaturated dicarboxylic acids or anhydrides thereof