I am trying to find a formula for the trace of certain matrix. To do that I was forced to determine the number of Dyck paths with prescribed number of edges.

By a Dyck path I mean a lattice path from $(0,0)$ to $(2n,0)$ consisting of $n$ steps of type $(1,1)$ and $n$ steps of type $(1,-1)$ never going below the $x$-axis (y=0). It is well known the number of Dyck paths equals the $n$th Catalan number.

If a multiindex $m=(m_{1},\dots,m_{\ell})\in\mathbb{N}^{\ell}$ is given I consider the set of Dyck paths which encounter edges $(j,j+1)$ and $(j+1,j)$ exactly $2m_{j}$ times. Let me denote the set of such paths by $\Omega(m)$. I can prove (and it is not very difficult) that $$ |\Omega(m)|=\prod_{j=1}^{\ell-1}\binom{m_j+m_{j+1}-1}{m_{j+1}}. $$

For sure, this has to be known. I would like to know some references on works dealing with these paths (depending on a multiindex). Since the problem I am working on is not in its nature combinatorial, I would like to only use the existing terminology and results and cite other papers. Perhaps someone knows the original work with the above formula. Thanks a lot.