<s>[INST] How many ways move n pies to m distances? A table size $1\times (m+n)$ squares. Give $n$ pies on the $n$ first squares. Now, I want move $n$ pies to the end of table by $m.n$ steps ($m$ steps for each pie), satify conditions one pie only move to an empty-adjacent square. Define $S(n,m)$ is number of all ways move to finished.
Prove that $$ S(n,m)=\dfrac{(n-1)^!(m-1)^!(m.n)!}{(n+m-1)^!} $$
There are symbol $x^!=1!2!...x!$

Example: $n=2; \; m=3$
$S(2,3)=\dfrac{(2-1)^!(3-1)^!(2.3)!}{(2+3-1)^!}=\dfrac{1!1!2!6!}{1!2!3!4!}=5$
$\begin{matrix}\begin{array}{|c|c|c|c|c|} \hline \circ&\circ&\;&\;&\;\\ \hline\end{array} & &\\ \downarrow & &\\ \begin{array}{|c|c|c|c|c|} \hline \circ&\;&\circ&\;&\;\\ \hline\end{array} & &\\ \downarrow & \searrow & \\ \begin{array}{|c|c|c|c|c|} \hline \circ&\;&\;&\circ&\;\\ \hline\end{array} & &\begin{array}{|c|c|c|c|c|} \hline \;&\circ&\circ&\;&\;\\ \hline\end{array}\\ \downarrow & \searrow & \downarrow\\ \begin{array}{|c|c|c|c|c|} \hline \circ&\;&\;&\;&\circ\\ \hline\end{array} & &\begin{array}{|c|c|c|c|c|} \hline \;&\circ&\;&\circ&\;\\ \hline\end{array}\\ \downarrow & \swarrow & \downarrow \\ \begin{array}{|c|c|c|c|c|} \hline \;&\circ&\;&\;&\circ\\ \hline\end{array} & &\begin{array}{|c|c|c|c|c|} \hline \;&\;&\circ&\circ&\;\\ \hline\end{array}\\ \downarrow & \swarrow &  \\ \begin{array}{|c|c|c|c|c|} \hline \;&\;&\circ&\;&\circ\\ \hline\end{array} & &\\  \downarrow & &\\ \begin{array}{|c|c|c|c|c|} \hline \;&\;&\;&\circ&\circ\\ \hline\end{array} & &\end{matrix}$
 [/INST] Please take a look at the following articles:
Article One
Article Two
</s>