function F =RamseySS (x,Wbarss,c0,l0, beta,chi0,chi1,sigma,eta,z,alpha,gamma,a,gss)

F=[(x(3)*(1 - x(5))^a)/((x(4)*(1 - x(5))^a)^sigma*(beta - 1)) - x(1) + (c0^sigma*sigma*(1 - l0)^(a*(sigma - 1))*(x(5)^alpha*(x(6)*x(7))^(1 - alpha) - chi0*x(6)*x(7)^chi1 + (a*x(4)*x(5))/(x(5) - 1) - (chi0*eta*x(6)*x(7)^chi1*(chi1*gamma - chi1*z + chi0*x(7)^chi1))/chi1))/(x(4)^(sigma + 1)*(1 - x(5))^(a*(sigma - 1))) - (a*c0^sigma*x(5)*(1 - l0)^(a*(sigma - 1)))/(x(4)^sigma*(1 - x(5))^(a*(sigma - 1))*(x(5) - 1)) - (sigma*x(2)*(gamma + 1)*(chi1 + chi0*eta*x(7)^chi1 + chi1*eta*gamma - chi1*eta*z))/(beta*chi1*x(4)) + (sigma*x(2)*(gamma + 1)*(chi1 + chi0*eta*x(7)^chi1 + chi1*eta*gamma - chi1*eta*z))/(beta^2*chi1*x(4))                                                                                                                                                                                                                                                                                                            ;
 alpha*x(5)^(alpha - 1)*x(1)*(x(6)*x(7))^(1 - alpha) - (c0^sigma*(1 - l0)^(a*(sigma - 1))*(alpha*x(5)^(alpha - 1)*(x(6)*x(7))^(1 - alpha) + (a*x(4))/(x(5) - 1) - (a*x(4)*x(5))/(x(5) - 1)^2))/(x(4)^sigma*(1 - x(5))^(a*(sigma - 1))) - (a*x(4)*x(3)*(1 - x(5))^(a - 1))/((x(4)*(1 - x(5))^a)^sigma*(beta - 1)) - (a*c0^sigma*(1 - l0)^(a*(sigma - 1))*(1 - x(5))^(a - a*sigma - 1)*(sigma - 1)*(x(5)^alpha*(x(6)*x(7))^(1 - alpha) - chi0*x(6)*x(7)^chi1 + (a*x(4)*x(5))/(x(5) - 1) - (chi0*eta*x(6)*x(7)^chi1*(chi1*gamma - chi1*z + chi0*x(7)^chi1))/chi1))/x(4)^sigma - (a*x(2)*(gamma + 1)*(sigma - 1)*(chi1 + chi0*eta*x(7)^chi1 + chi1*eta*gamma - chi1*eta*z))/(beta*chi1*(x(5) - 1)) + (a*x(2)*(gamma + 1)*(sigma - 1)*(chi1 + chi0*eta*x(7)^chi1 + chi1*eta*gamma - chi1*eta*z))/(beta^2*chi1*(x(5) - 1))                                                                                                                                 ;
 beta*(x(1)*(eta*gamma - eta*z + (eta*gamma^2)/2 - (eta*z^2)/2 + (x(5)^alpha*x(7))/(x(6)*x(7))^alpha - (chi0*x(7)^chi1)/chi1 + (chi0*eta*x(7)^chi1)/chi1 - (alpha*x(5)^alpha*x(7))/(x(6)*x(7))^alpha - (chi0^2*eta*x(7)^(2*chi1))/(2*chi1^2) + (chi0*eta*x(7)^chi1*z)/chi1 + 1) + (c0^sigma*(1 - l0)^(a*(sigma - 1))*(chi0*x(7)^chi1 - (x(5)^alpha*x(7))/(x(6)*x(7))^alpha - chi0*eta*x(7)^chi1 + (alpha*x(5)^alpha*x(7))/(x(6)*x(7))^alpha - chi0*eta*x(7)^chi1*z + (chi0^2*eta*x(7)^(2*chi1))/chi1))/(x(4)^sigma*(1 - x(5))^(a*(sigma - 1))) - (eta*x(2)*(gamma + 1)^2)/(beta*x(6))) - (x(1)*(gamma + 1)*(chi1 + chi0*eta*x(7)^chi1 + chi1*eta*gamma - chi1*eta*z))/chi1 + (eta*x(2)*(gamma + 1)*(beta + gamma + beta*gamma + beta*chi0*x(7)^chi1 + 1))/(beta*x(6)) - (eta*x(2)*(gamma + 1)*(gamma + chi0*x(7)^chi1 + 1))/(beta*x(6)) + (c0^sigma*chi0*eta*x(7)^chi1*(gamma + 1)*(1 - l0)^(a*(sigma - 1)))/(x(4)^sigma*(1 - x(5))^(a*(sigma - 1))) ;
 (chi0*eta*x(7)^(chi1 - 1)*x(2)*(gamma + 1))/beta - (chi0*x(7)^(chi1 - 1)*x(2)*(chi1*eta - chi1 + chi1^2 - chi1^2*eta*z - chi0*eta*x(7)^chi1 + chi1*eta*z + chi1^2*eta*gamma + 2*chi0*chi1*eta*x(7)^chi1))/(beta*chi1) - x(1)*(chi0*x(6)*x(7)^(chi1 - 1) + (x(6)*x(5)^alpha*(alpha - 1))/(x(6)*x(7))^alpha + (chi0*eta*x(6)*x(7)^(chi1 - 1)*(chi1*gamma - chi1*z + chi0*x(7)^chi1))/chi1) + (c0^sigma*x(6)*(1 - l0)^(a*(sigma - 1))*(alpha*x(5)^alpha*x(7) - x(5)^alpha*x(7) + 2*chi0^2*eta*x(7)^(2*chi1)*(x(6)*x(7))^alpha + chi0*chi1*x(7)^chi1*(x(6)*x(7))^alpha + chi0*chi1*eta*gamma*x(7)^chi1*(x(6)*x(7))^alpha - chi0*chi1*eta*x(7)^chi1*z*(x(6)*x(7))^alpha))/(x(4)^sigma*x(7)*(x(6)*x(7))^alpha*(1 - x(5))^(a*(sigma - 1)))                                                                                                                                                                                                                ;
 x(5)^alpha*(x(6)*x(7))^(1 - alpha) - gss - x(4) - x(6)*(gamma + 1) + (x(6)*(chi1 - chi0*x(7)^chi1))/chi1 - (eta*x(6)*(chi1*gamma - chi1*z + chi0*x(7)^chi1)^2)/(2*chi1^2)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ;
 (gamma - eta*(gamma + 1)*(z - (x(6)*(gamma + 1) + x(6)*((chi0*x(7)^chi1)/chi1 - 1))/x(6)) + 1)/beta - chi0*x(7)^chi1 + (eta*(z - (x(6)*(gamma + 1) + x(6)*((chi0*x(7)^chi1)/chi1 - 1))/x(6))^2)/2 + (chi0*x(7)^chi1)/chi1 - eta*x(6)*(((chi0*x(7)^chi1)/chi1 - 1)/x(6) - (x(6)*(gamma + 1) + x(6)*((chi0*x(7)^chi1)/chi1 - 1))/x(6)^2)*(z - (x(6)*(gamma + 1) + x(6)*((chi0*x(7)^chi1)/chi1 - 1))/x(6)) + chi0*eta*x(7)*x(7)^(chi1 - 1)*(z - (x(6)*(gamma + 1) + x(6)*((chi0*x(7)^chi1)/chi1 - 1))/x(6)) - 1                                                                                                                                                                                                                                                                                                                                                                                                                                        ;
 Wbarss - (x(4)*(1 - x(5))^a)^(1 - sigma)/((beta - 1)*(sigma - 1))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ];
