






'''simple docstring'''





from itertools import product






def    lowerCamelCase_     (    lowercase__				,     lowercase__):
	lowerCamelCase__  =     sides_number
	lowerCamelCase__  =     max_face_number * dice_number
	lowerCamelCase__  =     [0] * (max_total + 1)

	lowerCamelCase__  =     1
	lowerCamelCase__  =     range(_A				,     max_face_number + 1)
	for dice_numbers in product(_A				,     repeat=_A):
		lowerCamelCase__  =     sum(_A)
		totals_frequencies[total] += 1

	return totals_frequencies






def    lowerCamelCase_     (    ):
	lowerCamelCase__  =     total_frequency_distribution(
	    sides_number=4				,     dice_number=9)
	lowerCamelCase__  =     total_frequency_distribution(
	    sides_number=6				,     dice_number=6)

	lowerCamelCase__  =     0
	lowerCamelCase__  =     9
	lowerCamelCase__  =     4 * 9
	lowerCamelCase__  =     6
	for peter_total in range(_A				,     max_peter_total + 1):
		peter_wins_count += peter_totals_frequencies[peter_total] * sum(
		    colin_totals_frequencies[min_colin_total:peter_total])

	lowerCamelCase__  =     (4**9) * (6**6)
	lowerCamelCase__  =     peter_wins_count / total_games_number

	lowerCamelCase__  =     round(_A				,     ndigits=7)

	return rounded_peter_win_probability


if __name__ == "__main__":
	print(F"""{solution() = }""")









'''simple docstring'''





from __future__ import annotations
class 				lowercase       :


    '''simple docstring'''

    def __init__(					self     :     Optional[int]				,     __lowerCamelCase     :     int     )							->							None:

     '''simple docstring'''




     lowerCamelCase__  =     order

     # a_{0} ... a_{k}
     lowerCamelCase__  =     [1.0] + [0.0] * order
     # b_{0} ... b_{k}
     lowerCamelCase__  =     [1.0] + [0.0] * order

     # x[n-1] ... x[n-k]
     lowerCamelCase__  =     [0.0] * self.order
     # y[n-1] ... y[n-k]
     lowerCamelCase__  =     [0.0] * self.order

    def    a__				(					self     :     Dict				,     __lowerCamelCase     :     list[float]				,     __lowerCamelCase     :     list[float]     )							->							None:

     '''simple docstring'''




     if len(__lowerCamelCase     ) < self.order:
      lowerCamelCase__  =     [1.0, *a_coeffs]

     if len(__lowerCamelCase     ) != self.order + 1:
      lowerCamelCase__  =     (
          f'''Expected a_coeffs to have {self.order + 1} elements '''
          f'''for {self.order}-order filter, got {len(__lowerCamelCase     )}'''
      )
      raise ValueError(__lowerCamelCase     )

     if len(__lowerCamelCase     ) != self.order + 1:
      lowerCamelCase__  =     (
          f'''Expected b_coeffs to have {self.order + 1} elements '''
          f'''for {self.order}-order filter, got {len(__lowerCamelCase     )}'''
      )
      raise ValueError(__lowerCamelCase     )

     lowerCamelCase__  =     a_coeffs
     lowerCamelCase__  =     b_coeffs




    def    a__				(					self     :     Dict				,     __lowerCamelCase     :     float     )							->							float:

     '''simple docstring'''




     lowerCamelCase__  =     0.0

     # Start at index 1 and do index 0 at the end.
     for i in range(1				,     self.order + 1     ):
      result += (
          self.b_coeffs[i] * self.input_history[i - 1]
          - self.a_coeffs[i] * self.output_history[i - 1]
      )

     lowerCamelCase__  =     (result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

     lowerCamelCase__  =     self.input_history[:-1]
     lowerCamelCase__  =     self.output_history[:-1]

     lowerCamelCase__  =     sample
     lowerCamelCase__  =     result

     return result

