I was reading the following paper:
http://eml.berkeley.edu//~moretti/growth.pdf
I got stuck at equation (7)
The firm's production function is $Y_{i}=A_{i}L_{i}^{\alpha}K_{i}^{\eta}T_{i}^{1-\alpha-\eta}$
Labor supply is $W_{i}=V\frac{P_{i}^{\beta}}{Z_{i}}=V\frac{\bar{P_{i}}^{\beta}L_{i}^{\beta \gamma_{i}}}{Z_{i}}$
Labor demand is $L_{i}=(\frac{\alpha^{1-\eta}\eta^{\eta}}{R^{\eta}}\frac{A_{i}}{W_{i}^{1-\eta}})^{\frac{1}{1-\alpha-\eta}}T_{i}$
The paper says that if we impose aggregate labor demand is equal to aggregate labor supply (normalized to one), then the aggregate output $Y=\sum_{i}Y_{i}$ is
$Y=(\frac{\eta}{R})^{\frac{\eta}{1-\eta}}[\sum_{i}(A_{i}[\frac{\bar{Q}}{Q_{i}}]^{1-\eta})^{\frac{1}{1-\alpha-\eta}}T_{i}]^{\frac{1-\alpha-\eta}{1-\eta}}$
This step looks drastic to me. How can the aggregate output be derived from the above conditions?