Did you try using implicit differentiation and collecting the terms together?
Using the eqn: f(qi,Q-i)= P(qi+Q-i) - c + qiP'Q(qi+Q-i)=0
and the implicit fn rule: dQ-i/dqi = -df/dqi / df/dQ-i
= 2P'(Q) + qiP''(Q)/ P'(Q)+qiP''(Q)
why is it 2P'(Q) on the numerator and only P'(Q) on the denominator?? Any explanation would be greatly appreciated