function [ys,check]=modelka_steadystate(junk,ys)
check=0;

global sigma gama_m teta fi_LR fi_M fi_R fi_Y fi_1 q0_alfa q0_beta q0_N q0_Y q1_alfa q1_beta q1_N q1_R q1_Y;

Z_alfa=q0_alfa/(1-q1_alfa);
Z_R=0;
Z_beta=q0_beta/(1-q1_beta);
Z_N=q0_N/(1-q1_N);
Z_Y=q0_Y/(1-q1_Y);

N=-Z_N;
W=log((teta-1)*Z_alfa/teta);
Y=N+Z_Y/Z_alfa;
RR=log(sigma+exp(Y-Z_beta));
K=log(((teta-1)*(1-Z_alfa)/teta)/(exp(RR)-1))+Y;
II=log(exp(K)-(1-sigma)*exp(K-Y));
C=log(1-exp(II));


%fi_R*RB+fi_M*(M-M(-1)+RB+Z_beta-Y+Y)=fi_LR*RB(-1)+(RB+Z_beta-Y)+fi_Y*(Y)+fi_1+Z_R;
%RB=(Z_beta-Y+fi_Y*Y+fi_1-fi_M*Z_beta)/(fi_R+fi_M-fi_LR-1);
RB=(Z_beta-Y+fi_Y*Y+fi_1-fi_M*Z_beta)/(fi_R+fi_M-fi_R-1);

P=RB+Z_beta-Y;

M=log(gama_m/(exp(RB)-1))+RB+C;
B=((1+exp(M)-exp(W)-exp(M-Y-P)-(exp(RR)-1)*exp(K-Y))*inv(exp(RB-P-Y)-1));

ys=[B;C;II;K;M;N;P;RB;RR;W;Y;Z_alfa;Z_beta;Z_N;Z_R;Z_Y];
%ys =[C;II;Y;P;N;W;K;r;M;B;R;Z1;Z2];