envelope theorem in simultaneous games



Hello!

I have the following three player game

max p1*q1(p1, p2, p3) in p1
max p2*q2(p1,p2,p3)+w*q3(p1,p2,p3) in p2
max (p3-w)*q3(p1,p2,p3) in p3

w is exogenous, the demand functions (qi) may be the same between i
like 1-pi-b*(pi-average(pj))

Until now this can be solved easily. Let's denote the optimal
solutions as
pi1(w)=p1(w)*q1(p1(w), p2(w), p3(w))
pi2(w)=p2(w)*q2(p1(w), p2(w), p3(w))
pi3(w)=(p3(w)-w)*q3(p1(w), p2(w), p3(w))
where p1(w), p2(w) and p3(w) are the best response prices given w

My question is how could I compute dpi1/dw?

I was thinking about the envelope theorem, but for that I would need a
simple value function with some constraints, and I am not sure if the
original problem is equivalent to this (for firm 1)
max p1*q1(p1, p2, p3s) in p1
s.t. p2 = R2(p1, p3, w)
p3 = R3(p1, p2, w)
where Ri is the best reply function for firm i

Thanks for your help!

V

.