c[0, 0, p_, q_] := 1;
c[m_, k_, p_, q_] := If[
(k == 0 && m > 0) || k > m, 0,
c[m - 1, k, p, q] (Quotient[k p, q] - m + 1 + k)
- c[m - 1, k - 1, p, q]];
A[p_, q_] :=
x^q + Sum[
Inverse[Table[Table[c[m, k, p, q], {k, 1, q}], {m, 1, q}]][[q]][[m]] h^(q - m) y^(m - q ) x^m, {m, 1, q - 1}]
- y^p