function w_s=find_ws(gammmah,gammmahs,phi_H,phi_Fs,bet,bet_s,thetah,thetaf, ...
PI,PI_s,delta_H,delta_F,alp,alps,r,r_s,theta,thetas,l,l_s);

w_s=csolve(@(w_s) (1-gammmah)*(((((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))*((1-gammmahs* ... 
(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-thetas))/ ... 
(1-gammmahs))^(1/(thetas-1)))*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs))))^(-theta)* ...
((gammmah*(((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))^(-theta)+ ...
(1-gammmah)*(((((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))*((1-gammmahs* ... 
(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-thetas))/ ... 
(1-gammmahs))^(1/(thetas-1)))*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs))))^(1-theta)/ ...
(((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H))))^(-1)*(((alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))/((1-alp)*r))*l)^alp*l^(1-alp)))+ ...
gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(-thetas)* ...
(((1-gammmah)/(1-gammmahs))*((((((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))*((1-gammmahs* ... 
(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-thetas))/ ... 
(1-gammmahs))^(1/(thetas-1)))^(1-theta-thetas)* ...
(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta))/(((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))^(1-thetas))* ...
((gammmah*(((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))^(-theta)+ ...
(1-gammmah)*(((((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H)))*((1-gammmahs* ... 
(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-thetas))/ ... 
(1-gammmahs))^(1/(thetas-1)))*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ... 
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ... 
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ... 
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs))))^(1-theta)/ ...
(((phi_H/(phi_H-1))*((1-bet* ... 
thetah*PI^((delta_H-1)*(1-phi_H))) ... 
/(1-bet*thetah*PI^((1-delta_H)*phi_H)))) ... 
*(alp^(-alp)*(1-alp)^(-(1-alp))*r^alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ...
(1/((theta-1)*(1-alp))))^(1-alp)) ... 
*((1-thetah)/(1-thetah*PI^((delta_H-1) ... 
*(1-phi_H))))^(1/(1-phi_H))))^(-1)*(((alp* ...
((((1-thetah)/(1-thetah*PI^((delta_H-1)* ...
(1-phi_H))))^(1/(1-phi_H))*(phi_H/(phi_H-1))* ...
((1-bet*thetah*PI^((delta_H-1)*(1-phi_H)))/ ...
(1-bet*thetah*PI^((1-delta_H)*phi_H)))*alp^ ...
(-alp)*(1-alp)^(-(1-alp))*r^alp)^(1/(alp-1))* ...
(gammmah+(1-gammmah)*(1-gammmahs)*(((phi_Fs/ ...
(phi_Fs-1))*((1-bet_s*thetaf*PI_s^((delta_F-1)* ...
(1-phi_Fs)))/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ...
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ...
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)/ ...
(1-gammmahs*(((phi_Fs/(phi_Fs-1))*((1-bet_s* ...
thetaf*PI_s^((delta_F-1)*(1-phi_Fs))) ...
/(1-bet_s*thetaf*PI_s^((1-delta_F)*phi_Fs)))) ...
*(alps^(-alps)*(1-alps)^(-(1-alps))*r_s^alps*w_s^(1-alps)) ... 
*((1-thetaf)/(1-thetaf*PI_s^((delta_F-1) ... 
*(1-phi_Fs))))^(1/(1-phi_Fs)))^(1-theta)))^ ... 
(1/((theta-1)*(1-alp))))/((1-alp)*r))*l)^alp*l^(1-alp))))- ...
(((alps*w_s/((1-alps)*r_s))*l_s)^alps*l_s^(1-alps)),0.8,[],1e-10,2000);

