How to help maxima get equation grouped nicely



Suppose I have an equation of the form:

A*foo + A*bar + A*baz + B*quux

how can I get maxima to reformat this as:

A*(foo+bar+baz) + B*quux

Especially helpful would be hints about using "format".