In quantum field theory, the elements of the S-matrix are defined as the amplitude describing the transition from an initial $n$-particle state (the "in" state) to an final $m$-particle state: \begin{equation} S_{fi} = \langle \mathbf{q}_1,\dots,\mathbf{q}_m; \text{out} | \mathbf{p}_1,\dots,\mathbf{p}_n ; \text{in} \rangle \tag{1} \end{equation} To me it seems that this equation only makes sense if the amount of "in" particles is equal to the amount of "out" particles (i.e. $m=n$) otherwise we can not take the inner product. For instance, if $m=2$ and $n=3$, then we can write equation $(1)$ as: \begin{equation} \begin{pmatrix} \mathbf{q}_1 & \mathbf{q}_2 \end{pmatrix} \begin{pmatrix} \mathbf{p}_1 \\ \mathbf{p}_2 \\ \mathbf{p}_3 \end{pmatrix} =\ ? \end{equation} which is undefined. Therefore, my question is how to interpret equation $(1)$ if $m \neq n$?
I must admit that I have never studied the S-matrix in quantum mechanics. Therefore, I apologize in advance if this is a naive question.