Solution (source code)

= Solution

Let $\mathbf e_i$ be the $i$th coordinate vector and take $p$ to be zero whenever any argument is negative. Right jumps $i\to i+1$, left jumps $i\to i-1$, and absorption from compartment $1$ give the <chemical master equation>
$$
\begin{aligned}
\partial_t p(\mathbf a,t)
={}&\sum_{i=1}^{m-1}k_i^+
\left[(a_i+1)p(\mathbf a+\mathbf e_i-\mathbf e_{i+1},t)
-a_ip(\mathbf a,t)\right]\\
&+\sum_{i=2}^{m}k_i^-
\left[(a_i+1)p(\mathbf a-\mathbf e_{i-1}+\mathbf e_i,t)
-a_ip(\mathbf a,t)\right]\\
&+k_1^-\left[(a_1+1)p(\mathbf a+\mathbf e_1,t)
-a_1p(\mathbf a,t)\right].
\end{aligned}
$$