I want to factorize/simply this expression f = "a1a2+a1a3+a1a4+a4a2" to a1*(a2+a3)+a4*(a1+a2) for example (minimize number of operators).