One of the many applications of the $n$th Catalan number is to calculate the number of strings consisting of $n$ $X$'s and $n$ $Y$'s, such that any prefix of the string will contain at least as many $X$'s as $Y$'s (Dyck words).
However what if, in general, we want to find the number of strings with $n$ pairs of $X$ and $Y$ along with $m$ pairs of $A$ and $B$, such that for the both the pairs, the inequality holds true?