


from itertools import product


def 		lowercase_	(  _UpperCamelCase							,      _UpperCamelCase	):


			'''simple docstring'''







			__lowercase			       = sides_number
			__lowercase			       = max_face_number * dice_number
			__lowercase			       = [0] * (max_total + 1)

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

			return totals_frequencies


def 		lowercase_	(  ):


			'''simple docstring'''







			__lowercase			       = total_frequency_distribution(
			    sides_number=4							,      dice_number=9	)
			__lowercase			       = total_frequency_distribution(
			    sides_number=6							,      dice_number=6	)

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

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

			__lowercase			       = round(_UpperCamelCase							,      ndigits=7	)

			return rounded_peter_win_probability


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






import doctest
from collections import deque

import numpy as np
class 						lowerCamelCase_							:



					'''simple docstring'''







					def __init__(					self    ) ->      None:







								'''simple docstring'''

								__lowercase			       = [2, 1, 2, -1]
								__lowercase			       = [1, 2, 3, 4]






					def A   (					self    ) ->      list[float]:







								'''simple docstring'''

								__lowercase			       = len(self.first_signal    )
								__lowercase			       = len(self.second_signal    )

								__lowercase			       = max(snake_case_			,							snake_case_    )

								# create a zero matrix of max_length x max_length
								__lowercase			       = [[0] * max_length for i in range(snake_case_    )]

								# fills the smaller signal with zeros to make both signals of same length
								if length_first_signal < length_second_signal:
											self.first_signal += [0] * (max_length - length_first_signal)
								elif length_first_signal > length_second_signal:
											self.second_signal += [0] * (max_length - length_second_signal)
								for i in range(snake_case_    ):
											__lowercase			       = deque(self.second_signal    )
											rotated_signal.rotate(snake_case_    )
											for j, item in enumerate(snake_case_    ):
														matrix[i][j] += item

        # multiply the matrix with the first signal
								__lowercase			       = np.matmul(np.transpose(snake_case_    )			,							np.transpose(self.first_signal    )    )

								# rounding-off to two decimal places
								return [round(snake_case_			,							2    ) for i in final_signal]


if __name__ == "__main__":
	doctest.testmod()


