modified multiply to handle multiple terms for first polynomial