function ff = findssramsey_prud(guess)

global  betac sigman chik epsilon_n deltac deltac_g alphac_b alphac_g omegab omegag epsilon_k epsilon_y epsilon_b epsilon_g ... 
        phi_1 phi_2 phi_3 d0 d1 d2 delta_x em_row delta_nw taubar taub_bar iota_w gamma_w taug gamma_wg iota_wg mu_dmg
        %%gamma_w gamma_bank iota_w rho_r phi_pi phi_y rho_ab rho_ag r_ss
        %%pi_ss sigmac gamma_I gamma_k taub

kb=guess(1);
kg=guess(2);
nb=guess(3);
ng=guess(4);
em=guess(5);
nw=guess(6);

r=1/betac;
n=(nb^(1+epsilon_n)+ng^(1+epsilon_n))^(1/(1+epsilon_n)); 
ab=1;
ag=1;
capb=(1+taub_bar)*kb;
capg=(1+taug)*kg;
ast=capb+capg;
cta=nw/ast;
rl=r-gamma_w*(cta-iota_w)*(cta^2)-gamma_wg*(cta-iota_wg)*(cta^2);
x=(em+em_row)/(1-delta_x);
dmg=1-exp(-mu_dmg*x);
yb = ab*(1-dmg)*(kb^alphac_b)*(nb^(1-alphac_b));
abt=1-(em/(phi_1*yb));
z=phi_2*(abt^phi_3)*yb;
taubar=(phi_2*phi_3/phi_1)*(abt^(phi_3-1));
yg = ag*(1-dmg)*(kg^alphac_g)*(ng^(1-alphac_g));
rkb=(epsilon_b/(epsilon_b-1))*(rl-1);
rkg=(epsilon_g/(epsilon_g-1))*(rl-1);

y=((omegab^(1/epsilon_k))*yb^((epsilon_k-1)/epsilon_k)+(omegag^(1/epsilon_k))*yg^((epsilon_k-1)/epsilon_k))^(epsilon_k/(epsilon_k-1));
pb=(omegab*(y/yb))^(1/epsilon_k);
pg=(omegag*(y/yg))^(1/epsilon_k);
adj=(gamma_w/2)*((cta-iota_w)^2)*nw;
prf=(1+rkb-r)*capb+(1+rkg-r)*capg-adj; %% +(r-1)*nw;


ff1=kb/nb-(alphac_b*(1-dmg)*ab*(pb-taubar*phi_1*(1-abt)-phi_2*(abt^phi_3))/(rkb+deltac))^(1/(1-alphac_b));                     
ff2=kg/ng-(alphac_g*(1-dmg)*ag*pg/(rkg+deltac_g))^(1/(1-alphac_g));
ff3=chik*(n^(sigman-epsilon_n))*(nb^epsilon_n)-(1-alphac_b)*(yb/nb)*(pb-taubar*phi_1*(1-abt)-phi_2*(abt^phi_3));
ff4=chik*(n^(sigman-epsilon_n))*(ng^epsilon_n)-(1-alphac_g)*(yg/ng)*pg;
ff5=taubar-((phi_2*phi_3)/phi_1)*(abt^(phi_3-1));
ff6=(1-r+delta_nw)*nw-prf;
ff=[ff1, ff2, ff3, ff4, ff5, ff6]; 