In "Universal Algebra: Foundamentals and Selected Topics (pg. 107)" of Clifford Bergman the following Maltsev's theorem is intoduced for constructing congruences.
Let $\textbf{A}$ be an algebra and $\theta \subseteq A^2$. The congruence generated by $\theta$ is equal to the set of all pairs $(a, b)$ such that: \begin{gather*} \exists z_0, \dots,z_n \ \ \ \ \exists(x_0, y_0), \dots,(x_{n-1}, y_{n-1}) \in \theta \ \ \ \ \exists f_0,\dots, f_{n-1} \in F^*_{(A)} \end{gather*} such that \begin{gather*} a=z_0, b=z_n \\ \{z_i, z_{i+1}\}=\{f_i(x_i), f_i(y_i)\} \ \ \text{for} \ i<n \end{gather*}
Where $F^*_{(A)}$ is the monoid under the operation of composition generated by $F_{(A)}$, which is the set of elementary traslation of $\textbf{A}$. Here an illustration of how it works:
Then, to give an example, it is applied to characterize the principal congruences of a commutative ring with idendity $\textbf{R}$. In that case we have \begin{gather*} F^*_{(R)}=F_{(R)}=\{ax+b:a,b \in R\} \end{gather*} He wants to prove that the congruence generated by $(c, d)$ is $\{(rc+s, rd+s):r,s \in R \}$, showing that every step of the sequence $z_0, z_1, \dots, z_n$ collapses. For induction is sufficient showing that for $n=3$: \begin{align*} z_0=r_0c+s_0 \\ z_1=r_0d+s_0 = r_1c + s_1 \\ z_2=r_1d + s_1\\ \end{align*}
Here the book conclude with the following passages:
Then $s_0=r_1c +s_1 -r_0d$ so that $z_0=(r_0+r_1)c + (s_1-r_0d)$ while $z_2=(r_0+r_1)d + (s_1-r_0d)$
That, if they're right, concludes the demonstration but I can't get the last step, namely the expression for $z_2$. Surely I'm missing some easy steps, might you explain me how it is obtained? Thank you.

Given that $z_2 = r_1d + s_1$, by summing and subtracting $r_0d$, we get $$z_2 = r_0d + r_1d + s_1d -r_0d = (r_0 + r_1)d + (s_1 -r_0d).$$