Can anyone point me to a reference for the main term when approximating the exponential sum of the 3-fold divisor function? Specifically I want the main term in $$\sum _{n\leq x}d_3(n)e\left (an/q\right )\approx \frac {xf_x(q)}{q}$$ where $f_x(q)$ is a 2nd degree polynomial in $\log x$ with coefficients bounded by $q^\epsilon $. In https://arxiv.org/pdf/1908.04286.pdf (Prop. 3.1) I can find that such a polynomial exists, but I want the explicit coefficients for the $\log x$ powers.
The main term is of course given by a residue, specifically I think by (where $d=(q,r)$) $$\sum _{r=1}^qe\left (\frac {ar}{q}\right )\frac {1}{\phi (q/d)}Res_{s=1}\Bigg \{ \frac {x^s}{s}\sum _{n=1\atop {(n,q)=d}}^\infty \frac {d_3(n)}{n^s}\Bigg \} $$ so basically what I'm looking for is an explicit calculation of this residue (without having to doubt my full-of-mistakes-calculations).