
function [ys,check]=twocountry_steadystate(junk,ys);

global M_

paramfile_twocountry

nparams = size(M_.param_names,1);
for icount = 1:nparams
    eval(['M_.params(icount) = ',M_.param_names(icount,:),';'])
end


check=0;
ASSF= 1;
LambdaSSF = beta_;
L1SSF=10;
L2SSF=10;
ZSSF=1;
R_DSSF=1/beta_;
R_SSSF=1/beta_;
R_polSSF =1/beta_;
R_pvtSSF = 1/beta_ + 0.0075;
R_govSSF = 1/beta_ + 0.0025;
Q_pvtSSF = 1/(R_pvtSSF-kappa);
Q_govSSF = 1/(R_govSSF-kappa);
M2SSF = beta_/(Q_pvtSSF - beta_*kappa*Q_pvtSSF); 
M1SSF = psi_*(M2SSF-1)+1;
p2SSF = (epsilon_p -1)/epsilon_p;
KSSF = (alpha_*p2SSF*(L1SSF^(1-alpha_))/(((1/LambdaSSF)-(1-delta0))*M1SSF))^(1/(1-alpha_));
Y2SSF = (KSSF^alpha_)*(L2SSF^(1-alpha_));
YSSF = Y2SSF;
GSSF = 0.2*YSSF;
upsilon_pSSF = 1;
p_kSSF = 1;
I_hatSSF =KSSF*delta0;
ISSF =I_hatSSF; 
b_pvtSSF = (psi_*p_kSSF*ISSF)/(Q_pvtSSF*(1-kappa));
b_pvt_fiSSF = b_pvtSSF;
b_pvt_maSSF = 0;
b_gov_maSSF = (0.06*4*YSSF)/Q_govSSF;
b_govSSF = (b_bar_gov_ratioF*4*YSSF)/Q_govSSF - b_gov_maSSF;
sSSF =Q_pvtSSF*b_pvt_maSSF + Q_govSSF*b_gov_maSSF;
Pi_maSSF = (1+kappa*Q_pvtSSF)*b_pvt_maSSF + (1+kappa*Q_govSSF)*b_gov_maSSF -R_SSSF*sSSF;
TSSF = GSSF + ((b_bar_gov_ratioF*4*YSSF)/Q_govSSF) - Pi_maSSF - Q_govSSF*((b_bar_gov_ratioF*4*YSSF)/Q_govSSF)*(1-kappa);
CSSF =  YSSF - ISSF - GSSF;
piSSF=1;
p_starSSF = 1;
upsilon_wSSF =1;
MU_CSSF = ((CSSF - h*CSSF)^(-sigma_))*(1-beta_*h);
w2SSF = (1-alpha_)*p2SSF*(KSSF^alpha_)*(L2SSF^(-alpha_));
w2_starSSF = w2SSF;
w1SSF = w2_starSSF *((epsilon_w -1)/epsilon_w);
f1SSF = (w1SSF*(w2SSF^(epsilon_w))*L2SSF)/(1-theta_w*beta_);
f2SSF = (w2SSF^(epsilon_w)*L2SSF)/(1-theta_w*beta_);
x1SSF = (p2SSF*YSSF)/(1-theta_p*beta_);
x2SSF = YSSF/(1-theta_p*beta_);
uSSF = 1;
lambda2SSF = 0;
phiSSF = 4;
lambda1SSF =(phiSSF*(R_pvtSSF-R_DSSF))/(R_DSSF);
thetaSSF = (beta_*(1-vartheta)*(R_pvtSSF-R_DSSF))/((lambda1SSF/(1+lambda1SSF))-beta_*vartheta*phiSSF*(R_pvtSSF-R_DSSF));
OmegaSSF = 1 - vartheta + vartheta*thetaSSF*phiSSF;
nSSF = (Q_pvtSSF*b_pvtSSF + Delta*Q_govSSF*b_govSSF)/phiSSF;
dSSF = Q_pvtSSF*b_pvtSSF + Q_govSSF*b_govSSF+ sSSF - nSSF;


ASS= 1;
LambdaSS = beta_;
L1SS=1;
L2SS=1;
ZSS=1;
R_DSS=1/beta_;
R_SSS=1/beta_;
R_polSS =1/beta_;
R_H_pvtSS = 1/beta_ + 0.0075;
R_H_govSS = 1/beta_ + 0.0025;
Q_H_pvtSS = 1/(R_H_pvtSS-kappa);
Q_H_govSS = 1/(R_H_govSS-kappa);
piSS=1;
R_F_pvtSS = ((1+kappa*Q_pvtSSF))/(Q_pvtSSF);
R_F_govSS = ((1+kappa*Q_govSSF))/(Q_govSSF); 
M2SS = beta_/(Q_H_pvtSS - beta_*kappa*Q_H_pvtSS); 
M1SS = psi_*(M2SS-1)+1;
p_kSS = 1;
b_H_pvt_maSS = 0;
p_HSS = 1; 
p_FSS = 1;
XSS = 0.025*YSSF; 
pi_HSS = piSS;
p_H_starSS = p_HSS;
p2SS = p_H_starSS*((epsilon_p -1)/epsilon_p);
KSS = ((alpha_*p2SS*(L2SS^(1-alpha_)))/(((1/LambdaSS)-(1-delta0))*M1SS))^(1/(1-alpha_));
I_hatSS =KSS*delta0;
ISS =I_hatSS; 
b_H_FC_pvtSS = nu3*((R_H_pvtSS/R_F_pvtSS)^(-eta3))*(b_pvtSSF*p_FSS);
b_H_pvtSS = ((psi_*p_kSS*ISS)/(Q_H_pvtSS*(1-kappa)))-b_H_FC_pvtSS;
b_H_pvt_fiSS = b_H_pvtSS;
Y2SS = (KSS^alpha_)*(L2SS^(1-alpha_));
upsilon_pSS = p_H_starSS^(-epsilon_p);
YSS = Y2SS/upsilon_pSS;
Phi_bSS = exp(-Phi*b_Y_ratio);
b_F_pvtSS = (YSS/Phi)*(1-((Phi_bSS*(R_H_pvtSS-R_DSS))/(R_F_pvtSS-R_DSS)));
b_F_govSS = b_Y_ratio*YSS - b_F_pvtSS;
b_H_gov_maSS =(0.06*4*YSS)/Q_H_govSS;
b_H_gov_fiSS = (b_bar_gov_ratio*4*YSS)/Q_H_govSS - b_H_gov_maSS;
sSS =Q_H_pvtSS*b_H_pvt_maSS + Q_H_govSS*b_H_gov_maSS;
Pi_maSS = (1+kappa*Q_H_pvtSS)*b_H_pvt_maSS + (1+kappa*Q_H_govSS)*b_H_gov_maSS -R_SSS*sSS;
GSS = 0.2*YSS;
C_HSS =  YSS - ISS - GSS - XSS;
CSS = C_HSS*(p_HSS^eta1)/(1-nu1);
C_FSS = 0.4*CSS;
TSS = GSS + ((b_bar_gov_ratio*4*YSS)/Q_H_govSS) - Pi_maSS - Q_H_govSS*((b_bar_gov_ratio*4*YSS)/Q_H_govSS)*(1-kappa);
upsilon_wSS =1;
MU_CSS = ((CSS - h*CSS)^(-sigma_))*(1-beta_*h);
w2SS = (1-alpha_)*p2SS*(KSS^alpha_)*(L2SS^(-alpha_));
w2_starSS = w2SS;
w1SS = w2_starSS *((epsilon_w -1)/epsilon_w);
f1SS = (w1SS*(w2SS^(epsilon_w))*L2SS)/(1-theta_w*beta_);
f2SS = (w2SS^(epsilon_w)*L2SS)/(1-theta_w*beta_);
x1SS = (p2SS*(p_HSS^(epsilon_p -1))*YSS)/(1-theta_p*beta_);
x2SS = (p_HSS^(epsilon_p -1))*YSS/(1-theta_p*beta_);
uSS = 1;
lambda2SS = 0;
phiSS = 4;
lambda1SS =(phiSS*(R_H_pvtSS-R_DSS))/(R_DSS);
thetaSS = (beta_*(1-vartheta)*(R_H_pvtSS-R_DSS))/((lambda1SS/(1+lambda1SS))-beta_*vartheta*phiSS*(R_H_pvtSS-R_DSS));
OmegaSS = 1 - vartheta + vartheta*thetaSS*phiSS;
ESS =(C_FSS - XSS + b_H_FC_pvtSS + b_H_pvtSS*(1+kappa*Q_H_pvtSS) -Q_H_pvtSS*b_H_FC_pvtSS*(1-kappa)- Q_H_pvtSS*b_H_pvtSS+((b_bar_gov_ratio*4*YSS)/Q_H_govSS)*(1+kappa*Q_H_govSS-Q_H_govSS)-(R_DSS-1)*(Q_H_pvtSS*b_H_pvt_fiSS+Q_H_govSS*b_H_gov_fiSS+sSS)+(R_DSS-1)*(((Q_H_pvtSS*b_H_pvtSS+Delta*Q_H_govSS*b_H_gov_fiSS))/(phiSS)) - (1+kappa*Q_H_pvtSS)*b_H_pvt_maSS-(1+kappa*Q_H_govSS)*b_H_gov_maSS+ R_SSS*sSS)/((R_DSS-1)*Q_pvtSSF*b_F_pvtSS+(R_DSS-1)*Q_govSSF*b_F_govSS - ((R_DSS-1)*(Q_pvtSSF*b_F_pvtSS+Delta*Q_govSSF*b_F_govSS)/(phiSS))); 
nSS = (Q_H_pvtSS*b_H_pvtSS + ESS*Q_pvtSSF*b_F_pvtSS+ Delta*Q_H_govSS*b_H_gov_fiSS+Delta*ESS*Q_govSSF*b_F_govSS )/phiSS;
dSS = Q_H_pvtSS*b_H_pvt_fiSS +ESS*Q_pvtSSF*b_F_pvtSS + Q_H_govSS*b_H_gov_fiSS +ESS*Q_govSSF*b_F_govSS+ sSS - nSS;




ys = [ASSF    
CSSF      
GSSF                                                                                                                                                                                                                                                                               
ISSF 
I_hatSSF 
KSSF 
L1SSF
L2SSF
M1SSF
M2SSF
MU_CSSF
Q_govSSF 
Q_pvtSSF
R_DSSF 
R_govSSF 
R_polSSF 
R_pvtSSF
R_SSSF
TSSF
YSSF
Y2SSF
ZSSF
b_govSSF 
b_pvtSSF
b_gov_maSSF
b_pvt_fiSSF
b_pvt_maSSF
dSSF
f1SSF
f2SSF
nSSF
p_kSSF
p2SSF
p_starSSF
sSSF
uSSF
w1SSF
w2SSF
w2_starSSF
x1SSF
x2SSF
LambdaSSF  
Pi_maSSF
OmegaSSF 
thetaSSF
lambda1SSF
lambda2SSF
piSSF
upsilon_pSSF 
upsilon_wSSF
phiSSF
ASS    
CSS     
C_FSS 
C_HSS
ESS
GSS                                                                                                                                                                                                                                                                               
ISS 
I_hatSS 
KSS 
L1SS
L2SS
M1SS
M2SS
MU_CSS
Q_H_govSS
Q_H_pvtSS
R_DSS 
R_polSS 
R_SSS
R_F_govSS
R_F_pvtSS
R_H_govSS
R_H_pvtSS
TSS
XSS
YSS
Y2SS
ZSS
b_H_gov_fiSS
b_H_gov_maSS
b_H_FC_pvtSS
b_H_pvtSS
b_H_pvt_fiSS
b_H_pvt_maSS
b_F_govSS
b_F_pvtSS
dSS
f1SS
f2SS
nSS
p_kSS
p2SS
p_FSS
p_HSS
p_H_starSS
sSS
uSS
w1SS
w2SS
w2_starSS
x1SS
x2SS
LambdaSS  
Pi_maSS
OmegaSS 
thetaSS
lambda1SS
lambda2SS
piSS
pi_HSS
upsilon_pSS 
upsilon_wSS
phiSS
Phi_bSS
] ;


