Solution (source code)

= Solution

Write $m=\prod_pp^{n_p}$. For the modulus $m\infty$,
$$
\mathbb I_{\mathbb Q}(m\infty)
=\mathbb R_{>0}\times
\prod_{p\mid m}(1+p^{n_p}\mathbb Z_p)
\times\prod_{p\nmid m}\mathbb Z_p^\times.
$$
This is understood as the corresponding restricted-product subgroup of $\mathbb I_{\mathbb Q}$.