Finding constants in a polynomial given the factors