Let's set some conventions to begin with. Scattering matrix is given by $$ S = \begin{pmatrix} r'& t \\ t'& r \end{pmatrix} $$ Where, the reflection and transmission is given as below: Now introduce two scattering matrices $S_1$ and $S_2$ defined as $$ S_i = \begin{pmatrix} r_i'& t_i \\ t'_i& r_i \end{pmatrix} $$ The composed scattering matrix is $S_{12} = S_1 \circ S_2$ One needs to consider infinite number of reflection and transmissions in between the scattering matrices as below from both left and right directions as below (here I have made the assumption that the modes don't get a phase while propagation, otherwise one needs to carry a phase factor also): The effective transmission and reflection coefficients of $S_{12}$ are given by:
One can then take a series of scattering matrix and perform pairwise compositions. Note that the composition is associative.