How to expand sum?



Hello,

I would like to automatically expand sum expression:

sum(a*x[i]+b,i,1,n);

so it would look like:

ex:a*sum(x[i],i,1,n)+n*b

I know that for such case it is enough to use simpsum, but for expression like this

sum(x[i]*y[i]-a*x[i]^2-b*x[i],i,1,n), simpsum;

it doesnt work:

How do I achieve that for more complicated expressions?

Thanks and regards