I am working through lemma 2.2 of the Hardy-Littlewood Circle Method: Second Edition by R.C. Vaughan and I am having some trouble with a step in his proof of the following lemma:
Suppose that $X$, $Y$, and $\alpha$ are real numbers with $X,Y\geq 1$, and $\lvert\alpha-\frac{a}q\rvert \leq q^{-2}$ with $(a,q)=1$. Then, $$ \sum_{x\leq X} \min\left(XYx^{-1}, \lvert\lvert\alpha x\rvert\rvert^{-1}\right) \ll XY\left(\frac1q+\frac1Y+\frac{q}{XY}\right)\log(2Xq) $$ Where we take $\lvert\lvert\beta\rvert\rvert=\min_{y\in\mathbb{Z}}\lvert \beta-y\rvert$.
The proof opens by defining $S=\sum_{x\leq X} \min\left(XYx^{-1}, \lvert\lvert\alpha x\rvert\rvert^{-1}\right)$, and then states immediately that "Clearly" $$ S\leq \sum_{0\leq j\leq X/q}\sum_{r=1}^q \min\left(\frac{XY}{qj+r}, \lvert\lvert\alpha(qj+r)\rvert\rvert^{-1}\right) $$ But, I have no clue how we arrived at this step. I know that the $\lvert\alpha-a/q\rvert\leq q^{-2}$ looks like Dirichlet's theorem for Diophantine approximation, but I don't see quite how to apply it, or if it is even being used at this point in the proof. Can anyone provide a hint for this step or suggest some readings that provide a bit more detail on this proof?