function f=twofoc(z,param);
%TWOFOC  Steady-state first order conditions for model described in twosect.f.

%        Ellen McGrattan, 6-26-97
%        Revised, ERM, 9-24-97

a     = param(1);
alpk  = param(2);
alph  = param(3);
b     = param(4);
beta  = param(5);
delk  = param(6);
delh  = param(7);
eta   = param(8);
psi   = param(9);
sigma = param(10);
thetk = param(11);
theth = param(12);
zeta  = param(13);
tauxk = param(14);
tauxh = param(15);
tauk1 = param(16);
tauk2 = param(17);
tauh1 = param(18);
tauh2 = param(19);
tauc  = param(20);
z1    = param(21);
z2    = param(22);
z3    = param(23);

alp   = alpk+alph;
sigz  = sigma-zeta*(1-sigma);
betn  = beta*(1+eta/100)^sigz;
delk1 = 1-delk;
delh1 = 1-delh;
thet  = thetk+theth;
tauxk1= 1+tauxk;
tauxh1= 1+tauxh;
tauk11= 1-tauk1;
tauk21= 1-tauk2;
tauh11= 1-tauh1;
tauh21= 1-tauh2;
tauc1 = 1+tauc;

k     = z(1);
l     = z(2);
gam   = z(3);
v     = z(4);

phi   = tauk11*tauh21*alpk*theth/(tauk21*tauh11*alph*thetk);
u     = 1/(1-phi+phi/v);
gs    = gam^sigz;
g2    = (z2*a*(k*v)^alpk*(l*u)^alph)^(1/alp);
F     = a*(k*v)^alpk*(l*u)^alph*g2^(1-alp);
g1    = z1*F;
g3    = z3*F;
F1    = alpk * F/(k*v);
F2    = alph * F/(l*u);
G     = b*(k*(1-v))^thetk*(l*(1-u))^theth*g3^(1-thet);
xh    = G;
G2    = theth* G/(l*(1-u));
xk    = (gam-delk1)*k;
c     = F-xk-g1-g2-g3;

f(1)  = psi*c - (1-l)* F2 * tauh11/tauc1;
f(2)  = gs-betn*(delk1+F1*tauk11/tauxk1);
f(3)  = gs-betn*(delh1+G2*l*tauh21/tauxh1);
f(4)  = gam-delh1-xh;
f     = f(:);

