  We show that if a group contains $\mathbb{Z}^n \times F_m$ as a finite-index
subgroup, then its cogrowth series is the diagonal of a rational function for
every generating set. This answers a question of Pak and Soukup on the cogrowth
of virtually abelian groups; and generalises a result by Elder, Rechnitzer,
Janse van Rensburg, and Wong on the cogrowth series of the Baumslag-Solitar
groups $\mathrm{BS}(N,N)$.
