



from itertools import product
def 		UpperCamelCase	(   snake_case__       :    int       ,     snake_case__       :    int	)	->     list[int]:
   UpperCamelCase    :  Dict							=	sides_number
   UpperCamelCase    :  List[Any]							=	max_face_number * dice_number
   UpperCamelCase    :  Any							=	[0] * (max_total + 1)

   UpperCamelCase    :  Tuple							=	1
   UpperCamelCase    :  Dict							=	range(snake_case__       ,     max_face_number + 1	)
   for dice_numbers in product(snake_case__       ,     repeat=snake_case__	):
      UpperCamelCase    :  Optional[Any]							=	sum(snake_case__	)
      totals_frequencies[total] += 1

   return totals_frequencies
def 		UpperCamelCase	(   )	->     float:
   UpperCamelCase    :  Optional[Any]							=	total_frequency_distribution(
       sides_number=4       ,     dice_number=9	)
   UpperCamelCase    :  Dict							=	total_frequency_distribution(
       sides_number=6       ,     dice_number=6	)

   UpperCamelCase    :  Dict							=	0
   UpperCamelCase    :  Dict							=	9
   UpperCamelCase    :  Optional[int]							=	4 * 9
   UpperCamelCase    :  Tuple							=	6
   for peter_total in range(snake_case__       ,     max_peter_total + 1	):
      peter_wins_count += peter_totals_frequencies[peter_total] * sum(
          colin_totals_frequencies[min_colin_total:peter_total]	)

   UpperCamelCase    :  Union[str, Any]							=	(4**9) * (6**6)
   UpperCamelCase    :  int							=	peter_wins_count / total_games_number

   UpperCamelCase    :  Dict							=	round(snake_case__       ,     ndigits=7	)

   return rounded_peter_win_probability


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








import io
import json
import unittest

from parameterized import parameterized

from transformers import FSMTForConditionalGeneration, FSMTTokenizer
from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device
from utils import calculate_bleu


__UpperCAmelCase          =       get_tests_dir() + '''/test_data/fsmt/fsmt_val_data.json'''
with io.open(filename, '''r''', encoding='''utf-8''') as f:
    __UpperCAmelCase          =       json.load(f)



@require_torch
class 				lowerCAmelCase_		(  unittest.TestCase							):
       def 					snake_case_       (			self,			SCREAMING_SNAKE_CASE_       )     ->		List[str]:
          return FSMTTokenizer.from_pretrained(SCREAMING_SNAKE_CASE_       )
       def 					snake_case_       (			self,			SCREAMING_SNAKE_CASE_       )     ->		List[str]:
          UpperCamelCase    :  List[Any]							=	FSMTForConditionalGeneration.from_pretrained(SCREAMING_SNAKE_CASE_       ).to(SCREAMING_SNAKE_CASE_       )
          if torch_device == "cuda":
             model.half()
          return model






       @parameterized.expand(
           [
               ['en-ru', 26.0],
               ['ru-en', 22.0],
               ['en-de', 22.0],
               ['de-en', 29.0],
           ]       )
       @slow
       def 					snake_case_       (			self,			SCREAMING_SNAKE_CASE_,			SCREAMING_SNAKE_CASE_       )     ->		Any:
          # note: this test is not testing the best performance since it only evals a small batch
          # but it should be enough to detect a regression in the output quality
          UpperCamelCase    :  int							=	F"""facebook/wmt19-{pair}"""
          UpperCamelCase    :  Optional[int]							=	self.get_tokenizer(SCREAMING_SNAKE_CASE_       )
          UpperCamelCase    :  str							=	self.get_model(SCREAMING_SNAKE_CASE_       )

          UpperCamelCase    :  Dict							=	bleu_data[pair]['src']
          UpperCamelCase    :  Tuple							=	bleu_data[pair]['tgt']

          UpperCamelCase    :  List[Any]							=	tokenizer(SCREAMING_SNAKE_CASE_,			return_tensors='pt',			truncation=SCREAMING_SNAKE_CASE_,			padding='longest'       ).to(SCREAMING_SNAKE_CASE_       )
          UpperCamelCase    :  Any							=	model.generate(
              input_ids=batch.input_ids,			num_beams=8,			)
          UpperCamelCase    :  Tuple							=	tokenizer.batch_decode(
              SCREAMING_SNAKE_CASE_,			skip_special_tokens=SCREAMING_SNAKE_CASE_,			clean_up_tokenization_spaces=SCREAMING_SNAKE_CASE_       )
          UpperCamelCase    :  Optional[Any]							=	calculate_bleu(SCREAMING_SNAKE_CASE_,			SCREAMING_SNAKE_CASE_       )
          print(SCREAMING_SNAKE_CASE_       )
          self.assertGreaterEqual(scores['bleu'],			SCREAMING_SNAKE_CASE_       )



