function [res]=SolveSteadyState(x,ParaSet)
beta= ParaSet(1);
delta_h= ParaSet(2);
delta_k= ParaSet(3);
delta_g= ParaSet(4);
w= ParaSet(5);
w1= ParaSet(6);
w2= ParaSet(7);
sigma= ParaSet(8);
epsilo= ParaSet(9);
epsilo_y= ParaSet(10);
epsilo_f= ParaSet(11);
theta= ParaSet(12);
theta1= ParaSet(13);
theta2= ParaSet(14);
u= ParaSet(15);
tau= ParaSet(16);
b1= ParaSet(17);
b2= ParaSet(18);
phi_1= ParaSet(19);
phi_2= ParaSet(20);
kai= ParaSet(21);
eta= ParaSet(22);
z1= ParaSet(23);
z2= ParaSet(24);
alpha_k1= ParaSet(25);
alpha_k2= ParaSet(26);
alpha_n1= ParaSet(27);
alpha_n2= ParaSet(28);
alpha_l1= ParaSet(29);
alpha_l2= ParaSet(30);
Js= ParaSet(31);

LH1oYH1= ParaSet(32);
LH2oYH2= ParaSet(33);
gcoqm= ParaSet(34);
RD1s= ParaSet(35);
RD2s= ParaSet(36);
RB1s= ParaSet(37);
RB2s= ParaSet(38);
DGDP1s= ParaSet(39);
DGDP2s= ParaSet(40);
BGDP1s= ParaSet(41);
BGDP2s= ParaSet(42);

%beta_g= ParaSet(43);


N1s = x(1,1);
N2s = x(2,1);
qms = x(3,1);
qns = x(4,1);
ms = x(5,1);
ns = x(6,1);

RK1s=(1/beta-1+delta_k)/(1-tau);
RK2s=(1/beta-1+delta_k)/(1-tau);
K1s=alpha_k1*qms*ms/RK1s;
K2s=alpha_k2*qns*ns/RK2s;
W1s=alpha_n1*qms*ms/N1s;
W2s=alpha_n2*qns*ns/N2s;
QL1s=(alpha_l1/(1-alpha_l1))*LH1oYH1^(1/(alpha_l1-1));
QL2s=(alpha_l2/(1-alpha_l2))*LH2oYH2^(1/(alpha_l2-1));
F1s=(1-alpha_k1-alpha_n1)*qms*ms/QL1s;
F2s=(1-alpha_k2-alpha_n2)*qns*ns/QL2s;

mn1=((qms/theta)^(epsilo_y/(1-epsilo_y))-theta)/(1-theta);
m1on1=mn1^(-1/epsilo_y);
mn2=((qms/(1-theta))^(1-epsilo_y/(1-epsilo_y))-1+theta)/theta;
m2on2=mn2^(-1/epsilo_y);
Coef = [m1on1 m2on2; 1 1];
nvec = inv(Coef)*[ms; ns];
n1s = nvec(1);
n2s = nvec(2);
m1s = m1on1*n1s;
m2s = m2on2*n2s;

mc1s=(1-alpha_l1)^(alpha_l1-1)*alpha_l1^(-alpha_l1)*QL1s^alpha_l1;
mc2s=(1-alpha_l2)^(alpha_l2-1)*alpha_l2^(-alpha_l2)*QL2s^alpha_l2;
F11soF12s = mc1s;
F21soF22s = mc2s;
QHstar1s=F11soF12s*(eta/(eta-1));
QHstar2s=F21soF22s*(eta/(eta-1));
QH1s=QHstar1s;
QH2s=QHstar2s;

lamda1s=phi_1/((1-tau)*W1s);
lamda2s=phi_2/((1-tau)*W2s);
H1s=Js/(lamda1s*QH1s*(1+beta*(1-delta_h)));
H2s=Js/(lamda2s*QH2s*(1+beta*(1-delta_h)));
YH1s=delta_h*H1s;
YH2s=delta_h*H2s;
yh1s=YH1s;
yh2s=YH2s;
LH1s=LH1oYH1*YH1s;
LH2s=LH2oYH2*YH2s;

D1s=DGDP1s*(qms*ms);
D2s=DGDP2s*(qns*ns);
B1s=BGDP1s*(qms*ms);
B2s=BGDP2s*(qns*ns);

LG1s=D1s/(b1*QL1s);
LG2s=D2s/(b2*QL2s);
LS1s=LH1s+F1s;
LS2s=LH2s+F2s;
L1s=LS1s+LG1s;
L2s=LS2s+LG2s;

MH1s=LH1oYH1^(alpha_l1/(alpha_l1-1))*YH1s;
MH2s=LH2oYH2^(alpha_l2/(alpha_l2-1))*YH2s;

F12s=lamda1s*YH1s*QH1s^eta/(1-theta1*beta);
F22s=lamda2s*YH2s*QH2s^eta/(1-theta2*beta);
F11s=lamda1s*mc1s*YH1s*QH1s^eta/(1-theta1*beta);
F21s=lamda2s*mc2s*YH2s*QH2s^eta/(1-theta2*beta);
%F11s=F11soF12s*F12s;
%F21s=F21soF22s*F22s;

TR1s=w1*u*tau*((W1s*N1s+RK1s*K1s)+(W2s*N2s+RK2s*K2s));
TR2s=w2*u*tau*((W1s*N1s+RK1s*K1s)+(W2s*N2s+RK2s*K2s));
gcs=gcoqm*qms*ms;
gfs=u*tau*((W1s*N1s+RK1s*K1s)+(W2s*N2s+RK2s*K2s))-TR1s-TR2s-gcs;
T1s=(1-u)*tau*(W1s*N1s+RK1s*K1s)+QL1s*LS1s+TR1s;
T2s=(1-u)*tau*(W2s*N2s+RK2s*K2s)+QL2s*LS2s+TR2s;
gf1s=z1*(T1s+(1-RD1s)*D1s+(1-RB1s)*B1s);
gf2s=z2*(T2s+(1-RD2s)*D2s+(1-RB2s)*B2s);
gc1s=((1-z1)/z1)*gf1s;
gc2s=((1-z2)/z2)*gf2s;

bgc1s=gcs^epsilo*gc1s^(1-epsilo);
bgc2s=gcs^epsilo*gc2s^(1-epsilo);
kgfs=1/delta_g*gfs;
kgf1s=1/delta_g*gf1s;
kgf2s=1/delta_g*gf2s;
bkg1s=kgfs^epsilo_f*kgf1s^(1-epsilo_f);
bkg2s=kgfs^epsilo_f*kgf2s^(1-epsilo_f);

C1s=qms*ms-delta_k*K1s-MH1s-gc1s-gf1s-u*tau*(W1s*N1s+RK1s*K1s)+TR1s-qms*m2s+qns*n1s;
C2s=qns*ns-delta_k*K2s-MH2s-gc2s-gf2s-u*tau*(W2s*N2s+RK2s*K2s)+TR2s-qns*n1s+qms*m2s;

I1s=delta_k*K1s;
I2s=delta_k*K2s;

Y1s=(theta*m1s^epsilo_y+(1-theta)*n1s^epsilo_y)^(1/epsilo_y);
Y2s=(theta*m2s^epsilo_y+(1-theta)*n2s^epsilo_y)^(1/epsilo_y);


%res(1,1)=(1-theta)*(n1s^(epsilo_y-1))*(theta*m1s^(epsilo_y)+(1-theta)*n1s^(epsilo_y))^(1/epsilo_y-1)-qns;
%res(2,1)=theta*(n2s^(epsilo_y-1))*((1-theta)*m2s^(epsilo_y)+theta*n2s^(epsilo_y))^(1/epsilo_y-1)-qns;
res(1,1)=(1-theta)*(theta*(m1s/n1s)^epsilo_y+(1-theta))^(1/epsilo_y-1)-qns;
res(2,1)=theta*((1-theta)*(m2s/n2s)^epsilo_y+theta)^(1/epsilo_y-1)-qms;
res(3,1)=lamda1s-(C1s^(-sigma))*(bgc1s)^((1-sigma)*w);
res(4,1)=lamda2s-(C2s^(-sigma))*(bgc2s)^((1-sigma)*w);
res(5,1)=ms-K1s^alpha_k1*N1s^alpha_n1*F1s^(1-alpha_k1-alpha_n1)*bkg1s^kai;
res(6,1)=ns-K2s^alpha_k2*N2s^alpha_n2*F2s^(1-alpha_k2-alpha_n2)*bkg2s^kai;
