function ff = findss_tank(guess)

global  betac sigmac sigman epsilon_n chik deltac_d deltac_c alphac_c alphac_d phi_k phi_y epsilon_y epsilon_yy ...
        mu_dmg delta_x rho_r vi_pi vi_y rho_c rho_d ac_ss ad_ss r_ss pi_ss

kd=guess(1);
kc=guess(2);
nd=guess(3);
nc=guess(4);
cl=guess(5);

%ad=1;
ac=1;
rkc=(1/betac)+deltac_c-1;
rkd=(1/betac)+deltac_d-1;
%%n=(nc^(1+epsilon_n)+nd^(1+epsilon_n))^(1/(1+epsilon_n));
ec=(kc^alphac_c)*(nc^(1-alphac_c));  %%%damage on this?
ed=(kd^alphac_d)*(nd^(1-alphac_d));
%x=ed/(1-delta_x);
%dmg=1-exp(-mu_dmg*x);
y=ac*(ec^((epsilon_y-1)/epsilon_y)+ed^((epsilon_y-1)/epsilon_y))^(epsilon_y/(epsilon_y-1)); %%(1-dmg)*
id=deltac_d*kd;
ic=deltac_c*kc;
ch=y-cl-ic-id;
c=cl+ch; 
%pc = (y/ec)^(1/epsilon_y);
%pd = (y/ed)^(1/epsilon_y);
wd=(1-alphac_d)*(ed/nd);
wc=(1-alphac_c)*(ec/nc);
gini_income=(wc*nc)/(wd*nd);
gini_consumption=(ch/cl);


ff1=kd/nd-(alphac_d/rkd)^(1/(1-alphac_d));                     
ff2=kc/nc-(alphac_c/rkc)^(1/(1-alphac_c));
ff3=chik*(nd^sigman)*(cl^sigmac)-(1-alphac_d)*(ed/nd);
ff4=chik*(nc^sigman)*(ch^sigmac)-(1-alphac_c)*(ec/nc);
%%ff5=c-cl-ch;
ff5=cl-wd*nd;
ff=[ff1, ff2, ff3, ff4, ff5]; 