Let $M$ be a large positive integer, $d$ an odd positive integer and $f: \mathbb{Z}_{>0} \times \mathbb{Z}_{>0} \to \mathbb{R}$. For a non-principal character $\chi_d = \chi$ with modulus $d$, I am interested in the following type of sums. $$S(\chi, f) = \sum_{\substack{m = M \\ (m, d) = 1}}^{2M}f(m, d) \chi(m). $$
For $f \equiv 1$, we know that $\lvert S(\chi, f)\rvert \ll \sqrt{d}\log(d)$ by the Pólya–Vinogradov inequality. Now I am interested in bounding $\lvert S(\chi, f)\rvert$ when $$f(m, d) = \frac{\phi(m)}{m} \prod_{\substack{p \textrm{ prime} \\ (p, md) = 1}} \left(1 - \frac{\rho_{m}(p)}{p^2} \right)$$
where $\rho_m(p) = 1 + \genfrac(){}{}m p$ for primes $p$ that do not divide $m$. $\chi_d(m) = \genfrac(){}{}m d$, the Jacobi symbol.
I expect a similar result as the Pólya–Vinogradov inequality. Computational experiments for some $M$, $d$ values did agree with my expectation. Have these types of sums been studied earlier? Any help would be highly appreciated.
\mathbb{Z_{> 0}}
puts everything in bold (note that $\mathbb 0$); prefer $\mathbb{Z}_{> 0}$\mathbb{Z}_{> 0}
. Also prefer $a \ll b$a \ll b
to $a << b$a << b
. I have edited accordingly. $\endgroup$