An algorithm and its first implementation in C# are presented for assembling arbitrary quantum circuits on the base of Hadamard and Toffoli gates and for constructing multivariate polynomial systems over the finite field Z(2) axising when applying the Feymnan's sum-over-paths approach to quantum circuits. The matrix elements determined by a circuit can be computed by counting the number of common roots in Z(2) for the polynomial system associated with the circuit. To determine the number of solutions in Z(2) for the output polynomial system, one can use the Grobner bases method and the relevant algorithms for computing Grobner bases.