param_FX;
pK1=omega1+(1-omega1)*(omega1/(1-omega1))^rho1; 
pK2=omega2+(1-omega2)*(omega2/(1-omega2))^rho2; 
RER=1;
NER=1;
s=1;
r1_ss=1/beta1;
r2_ss=1/beta2;
r1=r1_ss;
r2=r2_ss;
 
%Define y
%country 1
X1=((omega1^(1-rho1))*((1-omega1)/omega1)^(-rho1)+(1-omega1)^(1-rho1))^(1/rho1);

%country 2
X2=((omega2^(1-rho2))*((1-omega2)/omega2)^(-rho2)+(1-omega2)^(1-rho2))^(1/rho2);

 
%final output
K2=(1/(X2*((1-omega2)/omega2)))-(((1-omega1)/omega1)*(1/X2));
y2=(1-((1-omega1)/omega1))*(1/K2);
xx=X2*((1-omega2)/omega2);
y1=1-y2/(xx);
y1=y1*X1;


xf1=y1*(1/X1);
xh2=y2*(1/X2);
xf2=y2*(1/X2)*(omega2/(1-omega2));
xh1=y1*(1/X1)*(omega1/(1-omega1));

A1=1;
A2=1;
 
w1=1;
w2=1;

%set labor to one as stated in the text (section 3.1.4)
l1=1;
l2=1;

ph1=-(vi1/(1-vi1))*(1/(1+tx1))*w1/A1;
ph2=-(vi1/(1-vi1))*(1/(1+tx1))*w1/A1;

pf1=-(vi2/(1-vi2))*(1+tx2)*w2/A2;
pf2=-(vi2/(1-vi2))*(1+tx2)*w2/A2;

%Headline price
p1=omega1*ph1^(rho1/(rho1-1))+(1-omega1)*pf1^(rho1/(rho1-1));
p1=p1^((rho1-1)/rho1);

p2=omega2*pf2^(rho2/(rho2-1))+(1-omega2)*ph2^(rho2/(rho2-1));
p2=p2^((rho2-1)/rho2);

l1=chi1^(1/(1+phi1));
l1=chi1^(1/(1+phi2));
c1=w1*l1/p1;
c2=w2*l2/p2;
 
%calibrate chi1 to match
% chi1=(w1/p1)*(1/(c1*l1));
% chi2=(w2/p2)*(1/(c2*l2));
% chi1=1.5;
% chi2=1.5;

%define M
M1=((r1-1)/r1)*(1/(c1*mi1));
M1=M1^(-1/sM1);
M1=M1*p1;

M2=((r2-1)/r2)*(1/(c2*mi2));
M2=M2^(-1/sM2);
M2=M2*p2;


%Utility 
U1=log(c1)-(chi1/(1+phi1))*l1^(1+phi1)+(mi1/(1-sM1))*(M1/p1)^(1-sM1);
U2=log(c2)-(chi2/(1+phi2))*l2^(1+phi2)+(mi2/(1-sM2))*(M2/p2)^(1-sM2);
% U1=log(c1)-(chi1/(1+phi1))*l1^(1+phi1);
% U2=log(c2)-(chi2/(1+phi2))*l2^(1+phi2);
 
%define steady state of G
g1=y1-c1;
g2=y2-c1;

g1_ss=g1;
g2_ss=g2;
 
%shocks

 
RR1=0;
RR2=0;

 
xm1=0;
xm2=0;
pi1=1;
pi2=1;

pih1=1;
pih2=1;

x=1;

pif1=1;
pif2=1;

if is_real
    w1=w1/p1;
    w2=w2/p2;
    M1=M1/p1;
    M2=M2/p2;
end
%this is wage inflation
w1=1;
w2=1;
p1_ss=p1;
p2_ss=p2;
K1=(pK1*((xf1/xh1)^rho1))^((rho1-1)/rho1);
K2=(pK2*((xh2/xf2)^rho2))^((rho2-1)/rho2);
MC1=w1/A1;
MC2=w2/A2;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%NO MARKUP ECONOMY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if no_mkup
pK1=omega1+(1-omega1)*(omega1/(1-omega1))^rho1; 
pK2=omega2+(1-omega2)*(omega2/(1-omega2))^rho2; 
RERn=1;
NERn=1;
sn=1;
r1_ss=1/beta1;
r2_ss=1/beta2;
r1=r1_ss;
r2=r2_ss;
 
%Define y
%country 1
X1=((omega1^(1-rho1))*((1-omega1)/omega1)^(-rho1)+(1-omega1)^(1-rho1))^(1/rho1);

%country 2
X2=((omega2^(1-rho2))*((1-omega2)/omega2)^(-rho2)+(1-omega2)^(1-rho2))^(1/rho2);

 
%final output
K2=(1/(X2*((1-omega2)/omega2)))-(((1-omega1)/omega1)*(1/X2));
y2=(1-((1-omega1)/omega1))*(1/K2);
xx=X2*((1-omega2)/omega2);
y1=1-y2/(xx);
y1=y1*X1;


xf1=y1*(1/X1);
xh2=y2*(1/X2);
xf2=y2*(1/X2)*(omega2/(1-omega2));
xh1=y1*(1/X1)*(omega1/(1-omega1));

A1=1;
A2=1;
 
w1=1;
w2=1;

%set labor to one as stated in the text (section 3.1.4)
l1=1;
l2=1;

ph1=-(vi1/(1-vi1))*(1/(1+tx1))*w1/A1;
ph2=-(vi1/(1-vi1))*(1/(1+tx1))*w1/A1;

pf1=-(vi2/(1-vi2))*(1+tx2)*w2/A2;
pf2=-(vi2/(1-vi2))*(1+tx2)*w2/A2;

%Headline price
p1=omega1*ph1^(rho1/(rho1-1))+(1-omega1)*pf1^(rho1/(rho1-1));
p1=p1^((rho1-1)/rho1);

p2=omega2*pf2^(rho2/(rho2-1))+(1-omega2)*ph2^(rho2/(rho2-1));
p2=p2^((rho2-1)/rho2);

l1=chi1^(1/(1+phi1));
l1=chi1^(1/(1+phi2));
c1=w1*l1/p1;
c2=w2*l2/p2;
 
%calibrate chi1 to match
% chi1=(w1/p1)*(1/(c1*l1));
% chi2=(w2/p2)*(1/(c2*l2));
% chi1=1.5;
% chi2=1.5;

%define M
M1=((r1-1)/r1)*(1/(c1*mi1));
M1=M1^(-1/sM1);
M1=M1*p1;

M2=((r2-1)/r2)*(1/(c2*mi2));
M2=M2^(-1/sM2);
M2=M2*p2;


%Utility 
U1=log(c1)-(chi1/(1+phi1))*l1^(1+phi1)+(mi1/(1-sM1))*(M1/p1)^(1-sM1);
U2=log(c2)-(chi2/(1+phi2))*l2^(1+phi2)+(mi2/(1-sM2))*(M2/p2)^(1-sM2);
% U1=log(c1)-(chi1/(1+phi1))*l1^(1+phi1);
% U2=log(c2)-(chi2/(1+phi2))*l2^(1+phi2);
 
%define steady state of G
g1=y1-c1;
g2=y2-c1;

g1_ss=g1;
g2_ss=g2;
 
%shocks

 
RR1=0;
RR2=0;

 
xm1=0;
xm2=0;
pi1=1;
pi2=1;

pih1=1;
pih2=1;

x=1;

pif1=1;
pif2=1;

if is_real
    w1=w1/p1;
    w2=w2/p2;
    M1=M1/p1;
    M2=M2/p2;
end
%this is wage inflation
w1=1;
w2=1;
p1_ss=p1;
p2_ss=p2;
K1=(pK1*((xf1/xh1)^rho1))^((rho1-1)/rho1);
K2=(pK2*((xh2/xf2)^rho2))^((rho2-1)/rho2);
MC1=w1/A1;
MC2=w2/A2;
end
% keyboard