function [param,ss] =finalcode202509_steady

[param1, ~]  = finalcode202509calib;

%%% £¨A£©Impatient household part
betai=param1(1);
b=param1(2);
a=param1(3);  
phi=param1(4); 
phi2=param1(5);   
taui=param1(6);
rhoXh=param1(7);  
rhoChi=param1(8); 
rhoDf2=param1(9);  
eta=param1(10);   
rhoRhoi=param1(11); 
rhoid=param1(12);    
rhoidf2=param1(13);  
deltadi=param1(14);  
rhoXi=param1(15);   
rhoOe=param1(16); 
L2=param1(17);
j=param1(18);

%%% £¨B£©Enterprise part 
betae=param1(19);    
beta=param1(20);    
met=0.7;    
met2=param1(22); 
taue=param1(23);  
deltak=param1(24);  
alpha=param1(25);
psi=param1(26);   
rhoA=param1(27);    
rhoRhoe=param1(28);    
rhoed=param1(29);    
rhoedf2=param1(30);  
deltade=param1(31);  
rhoXen=param1(32);

%%% £¨C£©Patient household part
betap=param1(33);   
rhoc=param1(34);  
L1=param1(35);

%%% £¨D£©Commercial bank part
sigmab=param1(36);    
betab=param1(37);
xb=param1(38);   
theta2=param1(39);   
miufin=param1(40);
rhoEta=param1(41);  

%%% £¨E£©Retailer part
theta=param1(42);    
epsilon=param1(43);   

%%% £¨F£©Central bank(monetary authority)and monetary policy rule part
rhoM=param1(44); 
rhoy=param1(45); 
rhopi=param1(46);  

%%% £¨G£©Government part
rhoG=param1(47); 

%--------------------------------------------------------- 
% Steady-state
%---------------------------------------------------------

Xh=1;         
Chi=1; 
A=1;  
Xi=1;
Xen=1;
Pi=1;
Pistar=1;
Xe=epsilon/(epsilon-1); 
Df2=0.1;
Oe=0.7;
Omegabar=(1-taui*Df2)*phi/Oe;   
Eta=0.08;

Probe=0.987; 
Probi=0.97;
Rd=1/betap;   

Rci=(1-(1-miufin*Eta)*(1-betab/betap))/betab/Probi;
Rce=(1-(1-miufin*Eta)*(1-betab/betap))/betab/Probe;
Rmi=(1-(1-miufin*Eta)*(1-betab/betap))/betab/(1-(Omegabar-a)/(b-a));
Rme=(1-(1-miufin*Eta)*(1-betab/betap))/betab;

A7=(1-betae*Rme)/Rme; 
A71=(1-betae*Probe*Rce)/Rce;
A8=alpha*(1+met2*Df2*A71/betae)/(1/betae-1+deltak)/Xe;  
A9=(betae*beta/Xe+A71*met2*Df2*beta/Xe)/(1-betae-(1-taue*Df2)*met*A7); 
A10=(1-taue*Df2)*met/Rme*A9;  
A72=met2*Df2/Xe/Rce;
A11=(alpha+beta)/Xe-deltak*A8+(1-Probe*Rce)*A72+(1-Rme)*A10; 

A3=(1-betai*Rmi/(b-a)*(b-Omegabar))/Rmi;  % Auxiliary variable 3, A3=Lambdai2/Lambdai
A31=(1-betai*Probi*Rci)/Rci; % Auxiliary variable 31, A31=Lambdai3/Lambdai
A32=phi2*Df2*((1-psi)*(1-alpha-beta)/Xe)/Rci;%  Auxiliary variable 32, A32=Bi/Ye  Wi*Ni/Ye=(1-psi)*(1-alpha-beta)/Xe
A4=((1-psi)*(1-alpha-beta)/Xe+A32-Probi*Rci*A32)/(1+(Omegabar-a)/(b-a)*j/(1-betai/(b-a)*(b-Omegabar)-(1-taui*Df2)*phi*A3)+((b-Omegabar)/(b-a)*Rmi-1)*(1-taui*Df2)*phi/Rmi*(j/(1-betai/(b-a)*(b-Omegabar)-(1-taui*Df2)*phi*A3)));   %  Auxiliary variable 4, A4=Ci/Ye
Ni=((1-psi)*(1-alpha-beta)/Xe/A4/L2)^(1/(1+eta));
A5=j/(1-betai/(b-a)*(b-Omegabar)-(1-taui*Df2)*phi*A3)*A4;  %  Auxiliary variable 5, A5=Qh*Hi/Ye
A6=(1-taui*Df2)*phi/Rmi*A5;  % Auxiliary variable 6, A6=Li/Ye

A2=(1-miufin*Eta)*(A6+A10+A72+A32);  
A1=psi*(1-alpha-beta)/Xe+1-1/Xe+(Rd-1)*A2-1/2/(b-a)*(Omegabar^2-a^2)*Oe*A5-0.34+(Omegabar-a)/(b-a)*A5; 
Np=(psi*(1-alpha-beta)/Xe/A1/L1)^(1/(1+eta));
A0=j/(1-betap)*A1; 

A13=A0+A5+A9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Li=LossLi/(Rmi*Li/Pi);
C=Cp+Ci+Ce+Cb;

param = param1;
ss = [Ci,Lambdai,Lambdai2,Lambdai3,Rmi,Omegabar,Pi,Qh,Xh,Hi,Chi,Df2,Wi,Ni,Li,Rci,Bi,Probi,Rhoi,Di,Qqi,Xi,Oe,...
    Ce,Lambdae,Lambdae2,Lambdae3,Ye,He,Xe,Le,K,Ik,A,Be,Probe,Rhoe,De,Qqe,Xen,Rme,Rce,...
    Wp,Np,Cp,Lambdap,Hp,Cashp,Dp,Rd,F,T,...
    Cb,Lambdab,Lambdab2,Kb,Eta,LossLi,DefaultLi,Pistar,G,C,RciRd,RmiRd,RceRd,RmeRd,RrRe,RrRi]';
end



