# Polynomials with multiple variables and abstract coefficients

Hey there,

I need to create a polynomials (say P1, P2) that will have a number of variables (ca. 5) and abstract coefficients (ca. 9) (but I can assume that coefficients are variables carrying integer values). Then I would like to multiply P1, P2 and collect variables and extract coefficients standing next to them, e.g

from
`XA * XB + XA^2 + 2 * A * XA + 4*XB / XC + 5`

I should be able to get
`2*A*XA + XA^2 + XA*XB + 4*XB/XC + 5`

and from this a list of coefficients like
`[2A, 1, 1, 4, 5]`

(with zeros in proper places eg. coefficient for XA*XB*XC)

Browsing the net I have found sth like:
```
B.<x,y,z> = QQ[];
A.<x,y,z>=B[];
ex = (1-a^2)*x*y^2+(a-b^2+c)*x*y*z+(b^2-c^2-a)*x^2*z;
ex.coefficients();
ex.monomials()
```

And my questions are:
(1.) how can I pass a list of variables to define a ring, I am interested in sth like
```
B.list = QQ[];
A.list2 = B[]
```

(2.) As you run the code above you can easily note that the output is:
```
[-x*y^2, x^2*z - x*y*z, -x^2*z, -x^2*z + x*y*z, x*y*z, x*y^2];
[a^2, b^2, c^2, a, c, 1]
```

As you can see the list from ex.coefficients() contains multiply entries for x*y^2 and -x*y^2 separately. And this is no go. Any ideas how can I fix it?

Thanks for any suggestions! Bests Michal