function y = F(x, betaa, varphi, sigma, omega_T, omega_N, omega_C, chi, delta, alpha_T, alpha_N, alpha_C, gammaa_T,phi_T,phi_N,phi_C,v_C,v_D,rho_C, rho_T, rho_N,  Dss, Rss, muss_T, muss_N, muss_C, TBss, Pss_C, KL_C, Wss_C, KL_T, Wss_T)


%betaa = 0.98;
%varphi = 0.5;  
%sigma = 2;
%omega_T = 1.455;
%omega_N = 1.455;
%omega_C = 1.455;
%chi = 0.35;
%delta = 0.025; 
%alpha_T = 0.35;
%alpha_N = 0.25;
%alpha_C = 0.35;
%gammaa_T = 0.05;
%phi_T = 4.6;
%phi_N = 9.3;
%phi_C =10.3;
%v_C = -0.014; 
%v_D = 0.077;
%rho_C = 0.88;
%rho_T = 0.87;
%rho_N = 0.84;
%psi_D = 0.077;
%psi_C = -0.014;

reer = x(1);
KL_N = x(2);
Lss_N = x(3);
Pss_N = x(4);

%Dss = 0.12;
%Rss = 1/betaa;
%muss_T = (1 - betaa*(1-delta))/betaa;
%muss_N = muss_T;
%muss_C = muss_T;
%TBss = (Rss-1)*Dss;
%Pss_C = 0.69;

% Commdity sector: {Kss_C/Lss_C and Wss_C}
%KL_C = (alpha_C*Pss_C/muss_C)^(1/(1-alpha_C));
%Wss_C = (1-alpha_C)*Pss_C*(KL_C^alpha_C);

% Tradable sector: {Kss_T/Lss_T and Wss_T}
%KL_T = ((alpha_T/muss_T)*(((gammaa_T*muss_T)/(Pss_C*alpha_T))^gammaa_T))^(1/(1 - alpha_T - gammaa_T));
%Wss_T = (1 - gammaa_T - alpha_T)*((gammaa_T*muss_T/Pss_C*alpha_T)^gammaa_T)*KL_T^(alpha_T + gammaa_T); 

% Nontradable sector: {solve numerically for reer, Kss_N/Lss_N, Lss_N and Pss_N}
y(1) = reer - (chi^varphi + ((1-chi)^varphi)*(Pss_N^(1-varphi)))^(1/(1 - varphi));
y(2) = muss_N - alpha_N*Pss_N*(KL_N^(alpha_N - 1));
y(3) = reer*(Lss_N^(omega_N - 1)) - (1-alpha_N)*Pss_N*(KL_N^alpha_N);
y(4) = Pss_N - ((1-chi)/chi)*(((((gammaa_T*muss_T)/(Pss_C*alpha_T))^gammaa_T)*(KL_T^(alpha_T + gammaa_T))*((Wss_T/reer)^(1/(omega_T - 1))) - delta*KL_T*((Wss_T/reer)^(1/(omega_T - 1))) - delta*KL_N*Lss_N - delta*KL_C*((Wss_C/reer)^(1/(omega_C - 1))) - (TBss - Pss_C*(((KL_C^alpha_C)*(Wss_C/reer)^(1/(omega_C-1))) - (gammaa_T/Pss_C)*((((gammaa_T*muss_T)/(Pss_C*alpha_T))^gammaa_T)*(KL_T^(alpha_T + gammaa_T))*((Wss_T/reer)^(1/(omega_T - 1)))))))/((KL_N^alpha_N)*Lss_N))^(1/varphi);

end




