function X = funx2(paramm,paramc)

omebar   = paramm(1);
SEome    = paramm(2);    
gamma    = paramm(3);
mu       = paramm(4);


tau     = paramc(1);
beta    = paramc(2);
delta   = paramc(3);
alpha   = paramc(4);
Omega   = paramc(5);
tetap   = paramc(6);
xbar    = paramc(7);
rrbar   = paramc(8);
Eome    = paramc(9);


mup     = tetap/(tetap-1);  
sbar    = 1/mup;

rbar    = 1/beta;   
rkbar   = rrbar*rbar;
zbar    = (rkbar - (1-delta))/(1-tau);    % rental price of capital
YbarK   = zbar/(sbar*alpha); 
WebarK  = sbar*(1-Omega)*(1-alpha)*YbarK;


sigmaW  = sqrt(log(1 + (SEome^2)/(Eome^2)));  
muW     = log(Eome) - 0.5*sigmaW^2;

vbar    = (muW - log(omebar))/sigmaW;
Fome    = logncdf(omebar,muW,sigmaW);
fome    = lognpdf(omebar,muW,sigmaW);
fomep   = -(fome/omebar)*(1 - (muW-log(omebar))/(sigmaW*sigmaW));
Fnome   = Eome - exp(muW+sigmaW*sigmaW/2)*normcdf(vbar+sigmaW,0,1);


SIG     = omebar*(1-Fome) + Fnome;
SIGp    = 1 - Fome;

muG     = mu*Fnome;
muGp    = mu*omebar*fome;


X = [logncdf(omebar,muW,sigmaW) - 0.03/4;
    (SIG - muG)*rrbar*xbar - xbar + 1;
    (1-tau)*WebarK/rkbar - 1/(xbar*rkbar) + gamma*(1 - (1/rrbar)*(1-1/xbar) - muG);
    rrbar*((1-SIG) + SIGp*(SIG-muG)/(SIGp-muGp)) - SIGp/(SIGp-muGp)];

% xbar - ((SIGp*(SIG-muG))/((1-SIG)*(SIGp-muGp)))% 
% WebarK/rkbar - 1/(xbar*rkbar) + gamma*(1 - (1/rrbar)*(1-1/xbar) - muG);
% WebarK/rkbar - 1/(xbar*rkbar) + gamma*(1 - SIG)

