Let $F_n$ denote the $n$-th Farey sequence, and let $q$ be a rational number such that $0 \leq q \leq 1$. I am studying the convergence of a specific integral related to Farey series, defined as follows.
Consider a density function $d\left(\frac{a}{b}\right)$ for a given rational number $q = \frac{a}{b}$, where $a$ and $b$ are coprime positive integers:
$$ d\left(\frac{a}{b}\right) = \frac{\left(\prod_{p_i\text{: prime factors of }a} (p_i + 1)\right)b}{\left(\prod_{q_i\text{: prime factors of }b} (q_i + 1)\right)a} $$
We define $d(0) = 0$ and $d(1) = 1$
Given a rational number $q$ and a positive integer $r$, we define the integral $I(q, r)$ as the sum of the areas of the rectangles formed by taking the differences between consecutive elements of the Farey sequence up to the order $r$ and only considering elements $\leq q$, and the heights being the density function values of the rightmost elements:
$$ I(q, r) = \sum_{k = 1}^{K} \left[\left(F^{(k)}_r - F^{(k - 1)}_r\right) \cdot d\left(F^{(k)}_r\right)\right], $$
where $K$ is the total number of elements in the Farey sequence up to order $r$ that are less than or equal to $q$, and $F^{(k)}_r$ denotes the $k$-th element of the Farey sequence of order $r$.
My question is: Does the integral $I(q, n)$ converge as $n \rightarrow \infty$ for a fixed $q$? If so, to what value? Also is the function $D(x) = \lim_{n \to \infty} I(x, n)$ continuous (over the rationals)? Any insights or references would be greatly appreciated.