Double sum depending only on sum of arguments

Lets suppose i have a sum of the type

$$\sum_{a=a_{\mathrm{min}}}^{a_{\mathrm{max}}}\sum_{b=b_{\mathrm{min}}}^{b_{\mathrm{max}}}f(a+b)$$

where $f$ is some well-defined function. I would like to rewrite the sum as a sum over the argument $M:=a+b$. What I have so far:

$$\sum_{a=a_{\mathrm{min}}}^{a_{\mathrm{max}}}\sum_{M=b_{\mathrm{min}}+a}^{b_{\mathrm{max}}+a}f(M)$$

Is it possible to write this is a sum over $M$ from $a_{\mathrm{min}}+b_{\mathrm{min}}$ to $a_{\mathrm{max}}+b_{\mathrm{max}}$, by introducing some factor in front of $f$?


Sure. So you can do something like $$\sum _{\substack{x+y=M\\a_{min}\leq x\leq a_{max}\\b_{min}\leq y\leq b_{max}}}f(M)=\sum _{M = a_{min}+b_{min}}^{a_{max}+b_{max}}\#\{\text{Ways }x+y=M\text{ with restrictions}\}\cdot f(M),$$ notice that if $x=i$ with $a_{min}\leq i\leq a_{max}$ then you want $b_{min}\leq M-i\leq b_{max}$ and so you want $M-b_{max}\leq i\leq M-b_{min}$ so you want $\max \{a_{min},M-b_{max}\}\leq i\leq \min \{a_{max},M-b_{min}\}$ and there are $\min \{a_{max},M-b_{min}\}-\max \{a_{min},M-b_{max}\}+1$ integers in between that. So

$$\sum _{M = a_{min}+b_{min}}^{a_{max}+b_{max}}\left (\min \{a_{max},M-b_{min}\}-\max \{a_{min},M-b_{max}\}+1\right )\cdot f(M)$$