expand sum from x=0 to x=n of x^2 - 6x + 3