code: def cycle_product_for_two_polynomials(
      p1: Polynomial, p2: Polynomial, q: Union[float, int, Fraction]
  ) -> Union[float, int, Fraction]:
      """
      Compute the product of
      given cycle indices p1,
      and p2 and evaluate it at q.
      """
      ans = Fraction(0, 1)
      for m1 in p1.monomials:
          for m2 in p2.monomials:
              ans += cycle_product(m1, m2).substitute(q)
  
      return ans
  
file_path: keon-algos/algorithms/maths/symmetry_group_cycle_index.py
imports: from fractions import Fraction
  from typing import Dict, Union
  from polynomial import Monomial, Polynomial
  from gcd import lcm
label_desc: Use image node_id 2 for calling a global function with example usage: cycle_product_for_two_polynomials(p1, p2, q) and returns: ans