Fibered products of cyclic groups

Background

Let $m,n$ be positive integers and consider the cyclic group $\mathbb{Z}_{mn}$.

We have a natural epimorphism $\mathbb{Z}_{mn} \to \mathbb{Z}_n$ coming from the exact sequence

$$0 \to \mathbb{Z}_m \to \mathbb{Z}_{mn} \to \mathbb{Z}_n \to 0$$ where the homomorphism $\mathbb{Z}_m \to \mathbb{Z}_{mn}$ is multiplication by $n$.

Now let $\ell$ be another positive integer and consider the cyclic groups $\mathbb{Z}_{\ell n}$ and $\mathbb{Z}_{m n}$ with their respective epimorphisms to $\mathbb{Z}_n$. Then the fibered product $\mathbb{Z}_{\ell n} \times_{\mathbb{Z}_n} \mathbb{Z}_{m n}$ is defined to be the subgroup of $\mathbb{Z}_{\ell n} \times \mathbb{Z}_{m n}$ consisting of elements $(a,b)$ with $a=b \mod n$. (In less evil language, this is the categorical pullback of one of the two epimorphisms along the other.)

Now let $r \in \mathbb{Z}_n^\times$ be a multiplicative unit, so that multiplication by $r$ defines an automorphism of $\mathbb{Z}_n$, and consider modifying one of the epimorphisms above by post-composing with multiplication by $r$. This gives rise to a different (in general) fibered product $$\mathbb{Z}_{\ell n} \times_{(\mathbb{Z}_n,r)} \mathbb{Z}_{m n} = \lbrace (a,b) \in \mathbb{Z}_{\ell n} \times \mathbb{Z}_{m n} \mid a = r b \mod n \rbrace,$$ which agrees with the one above when $r=1$.

Question

Is there an easy way to determine the isomorphism type of $\mathbb{Z}_{\ell n} \times_{(\mathbb{Z}_n,r)} \mathbb{Z}_{m n}$, say as a product of cyclic groups?

In some special cases ($n=1$, $k = \ell$,...) one can do this without too much effort, but I was wondering whether there is a general expression. I would also be happy with any pointers to the literature. I'm also interested in fibered products of other finite groups (not necessarily cyclic) and was wondering whether it would be sensible to spend some time determining them up to isomorphism.

-

The group $G=\mathbb{Z}_{\ell n} \times_{(\mathbb{Z}_n,r)} \mathbb{Z}_{m n}$ is isomorphic to $\mathbb{Z}_{an} \times\mathbb{Z}_b$ where $a$ is the least common multiple of $\ell$ and $m$ and $b$ is their highest common factor.
There is $r'\in\mathbb{Z}_{\ell n}^\times$ with $r'\equiv r$ (mod $n$). Then $g=(r',1)$ has order $an$ in $G$ which is then easily seen to have exponent $an$. Then $\langle g\rangle$ is a direct summand of $G$. As $G$ is a quotient of $\mathbb{Z}^2$ then it is the product of two cyclic groups and so the other one must be $\mathbb{Z}_b$ where $b=|G|/(an) =\ell m/a$ is the highest common factor of $\ell$ and $m$.