    function F = SS_Solver(x,beta,chi0,chi1,b,ew,eta,alpha,ep,omega1,omega2,theta,uf,tauk,tauc,taul,PercG,PercGdev,bbarUK,varpi,PercOilRec,PercOilRev,mco,po,dbaruk)

%variables conventions

%Scotland/UK: (we impose SS equilibrium symmetry)
 C=x(1);
 N=x(2);
 K=x(3);
 I=x(4);
 Wreal=x(5); 
 T=x(6);
 ph=x(7);   
 Yh=x(8);
 Yf=x(9);
 Yrow=x(10);
 Y=x(11);
 G=x(12);

% Area wide variables
 Gnodev=x(13);

% Other expressions
 MC=x(14);
 Gdev=x(15);
 qo=x(16);
 Rk=x(17);
 bb=x(18);
 Yhstarstar=x(19); 
 TB=x(20);
 RERrow=x(21);
 tauo=x(22);

%Identities
deltabar=chi0/chi1;
Rstar=1/beta;
Rstarstar=Rstar;


%Preliminary assumptions
zeta=1;


F = [Rk*(1-tauk)-chi0;
     I-deltabar*K; % Capital LOM %OK
     (1-taul)/(1+tauc)*Wreal/(C*(1-b))-ew/(ew-1)*N^eta; % Wage setting   %OK
     N/K-(1-alpha)/alpha*Rk/Wreal; % Firm input combination   %OK
     Yh+Yf+Yhstarstar-K^alpha*N^(1-alpha); % Production (Intermediate goods) We exploit Yhstar=Yf*varpi/(1-varpi) in a symmetric equilibrium and therefore Yhstar*(1-varpi)/varpi=Yf;
     ph-ep/(ep-1)*MC;  %Price setting (Intermediate goods) %OK
     MC-Rk^alpha*Wreal^(1-alpha)/((1-alpha)^(1-alpha)*alpha^alpha); %MC %OK
     Yh/Yf-omega1/omega2;  %OK
     Yh/Yrow-omega1/(1-omega1-omega2)*(ph/RERrow)^(-theta); %OK
     Y-(omega1^(1/theta)*Yh^((theta-1)/theta)+omega2^(1/theta)*Yf^((theta-1)/theta)+(1-omega1-omega2)^(1/theta)*Yrow^((theta-1)/theta))^(theta/(theta-1)) % Production (Final good) %OK
     1-uf*(omega1*ph^(1-theta)+omega2*(ph)^(1-theta)+(1-omega1-omega2)*(RERrow)^(1-theta))^(1/(1-theta)) % Price setting (Final good) %OK
     Y*PercG-G;  %Non-Devolved expenditure %OK
     G*PercGdev-Gdev;    %Devolved expenditure %OK
     G-Gdev-zeta*Gnodev;  %Public expenditure (region wide) %OK
     Y-C-I-G;   %Market clearing condition %OK
     dbaruk*(1/Rstarstar-1)-TB/Y-PercOilRec; % Long-run NFA calibration %OK
     bb*(1/Rstar-1)-(1-varpi)/varpi*(dbaruk*(1/Rstarstar-1)-TB/Y-PercOilRec/(1-varpi))+(tauc*C+taul*Wreal*N+tauk*Rk*K-G-T)/Y; % HH budget constraint %OK
     bbarUK/Rstar+tauk*Rk*K/Y+taul*Wreal/Y*N+tauc*C/Y+PercOilRec-bbarUK-Gdev/Y-Gnodev/Y-T/Y; %Westminster balance sheet %OK
     po*qo-PercOilRev*Y;  % Oil q.ty set to match Oil Revenue over GDP
     PercOilRec*Y-(po-mco)*qo*tauo;
     Yhstarstar-(1-omega1-omega2)*(ph/RERrow)^(-theta)*Y; % Wedge between ROW Import and Export 
     TB-ph*Yhstarstar+RERrow*Yrow];   % SS Balance of Trade between UK and ROW
      
 
 
 
 
 
 
 
 
 
     
 
  
