function F = solvessd(Q,ks,BETAH,Z_ss,CHI,ALPHAC,THETA,SIGMAS,SIGMAC,ETA_S,Y_ss,ETA_C,OMEGAK)

%% solving for Q and ks
R_ss=1/BETAH;
Rs=(Z_ss+Q)/Q;
Spreads=Rs-R_ss;
phis=R_ss/(THETA-Spreads);
kc=1-ks;
ns=Q*ks/phis;
ds=Q*ks-ns;
q=Q;
%wc = ETA_C*Y_ss;
phic=((Z_ss+Q)/R_ss-Q-ALPHAC*kc)/(OMEGAK*Q)+1/CHI;
nc=q*kc/phic;
dc=ALPHAC/2*kc^2-nc+OMEGAK/2*(phic-1/CHI)^2*nc+Q*kc;

F(1)=SIGMAS*((Z_ss+Q)*ks-R_ss*ds)+(1-SIGMAS)*ETA_S*Y_ss-ns;
F(2)=SIGMAC*((Z_ss+Q)*kc-R_ss*dc)+(1-SIGMAC)*ETA_C*Y_ss-nc;

