\begin{align*}
C_{ji}^{i,p}=
&\frac{c_{ji}}{2}\sum_{\scriptstyle (0\leq k \leq K_3-1)\cup(K_4\leq k \leq K_L-1)}(x_k-x_{k-1}) \big[q^{i,p}_{ji,k-1}\left(1+\frac{\gamma_1 n_{ji,k-1}^p(2\beta-\gamma_2  n_{ji,k-1}^p)}{(\beta-\gamma_2  n_{ji,k-1}^p)^2}\right)
+\\
&c_{ji} q^{i,p}_{ji,k}\left(1+\frac{\gamma_1 n_{ji,k}^p(2\beta-\gamma_2  n_{ji,k}^p)}{(\beta-\gamma_2  n_{ji,k}^p)^2}\right)
 \big]+ \frac{c_{ji}}{2} \sum_{K_3\leq k \leq K_4-1}(x_k-x_{k-1} )(q^{i,p}_{ji,k-1} +q^{i,p}_{ji,k})
 \end{align*}
