
from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt







def        __UpperCamelCase					(    lowerCAmelCase__							:    Tuple  ):
 __a			:  int		    =  int(number**0.5  )
 return number == sq * sq







def        __UpperCamelCase					(    lowerCAmelCase__							:    Any  ,       lowerCAmelCase__							:    Tuple  ,       lowerCAmelCase__							:    List[Any]  ,       lowerCAmelCase__							:    str  ,       lowerCAmelCase__							:    Tuple  ,       lowerCAmelCase__							:    List[str]  ):
 __a			:  int		    =  x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
 __a			:  int		    =  x_den * y_den * z_den
 __a			:  int		    =  gcd(__lowerCamelCase  ,       __lowerCamelCase  )
 top //= hcf
 bottom //= hcf
 return top, bottom







def        __UpperCamelCase					(    lowerCAmelCase__							:    List[str] = 3_5  ):
 __a			:  set		    =  set()
 __a			:  int
 __a			:  Fraction		    =  Fraction(0  )
 __a			:  tuple[int, int]

 for x_num in range(1  ,       order + 1  ):
  for x_den in range(x_num + 1  ,       order + 1  ):
   for y_num in range(1  ,       order + 1  ):
    for y_den in range(y_num + 1  ,       order + 1  ):
     # n=1
     __a			:  Union[str, Any]		    =  x_num * y_den + x_den * y_num
     __a			:  List[str]		    =  x_den * y_den
     __a			:  Tuple		    =  gcd(__lowerCamelCase  ,       __lowerCamelCase  )
     z_num //= hcf
     z_den //= hcf
     if 0 < z_num < z_den <= order:
      __a			:  Union[str, Any]		    =  add_three(
          __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  )
      unique_s.add(__lowerCamelCase  )

     # n=2
     __a			:  Union[str, Any]		    =  (
         x_num * x_num * y_den * y_den + x_den * x_den * y_num * y_num
     )
     __a			:  int		    =  x_den * x_den * y_den * y_den
     if is_sq(__lowerCamelCase  ) and is_sq(__lowerCamelCase  ):
      __a			:  List[Any]		    =  int(sqrt(__lowerCamelCase  )  )
      __a			:  List[str]		    =  int(sqrt(__lowerCamelCase  )  )
      __a			:  Tuple		    =  gcd(__lowerCamelCase  ,       __lowerCamelCase  )
      z_num //= hcf
      z_den //= hcf
      if 0 < z_num < z_den <= order:
       __a			:  Tuple		    =  add_three(
           __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  )
       unique_s.add(__lowerCamelCase  )

        # n=-1
     __a			:  Any		    =  x_num * y_num
     __a			:  Dict		    =  x_den * y_num + x_num * y_den
     __a			:  Any		    =  gcd(__lowerCamelCase  ,       __lowerCamelCase  )
     z_num //= hcf
     z_den //= hcf
     if 0 < z_num < z_den <= order:
      __a			:  List[Any]		    =  add_three(
          __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  )
      unique_s.add(__lowerCamelCase  )

     # n=2
     __a			:  Optional[Any]		    =  x_num * x_num * y_num * y_num
     __a			:  Union[str, Any]		    =  (
         x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
     )
     if is_sq(__lowerCamelCase  ) and is_sq(__lowerCamelCase  ):
      __a			:  Tuple		    =  int(sqrt(__lowerCamelCase  )  )
      __a			:  List[Any]		    =  int(sqrt(__lowerCamelCase  )  )
      __a			:  List[Any]		    =  gcd(__lowerCamelCase  ,       __lowerCamelCase  )
      z_num //= hcf
      z_den //= hcf
      if 0 < z_num < z_den <= order:
       __a			:  List[str]		    =  add_three(
           __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  ,       __lowerCamelCase  )
       unique_s.add(__lowerCamelCase  )

 for num, den in unique_s:
  total += Fraction(__lowerCamelCase  ,       __lowerCamelCase  )

 return total.denominator + total.numerator


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


import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
      from transformers import AutoModelForSeqaSeqLM, AutoTokenizer



@require_torch
@require_sentencepiece
@require_tokenizers
class 		UpperCamelCase__  (	unittest.TestCase   ):
   @slow
   def 				lowerCAmelCase      (self			: Tuple       ):
    __a			:  List[str]		    =  AutoModelForSeqaSeqLM.from_pretrained('''google/mt5-small''' ,    return_dict=snake_case_       ).to(snake_case_       )
    __a			:  List[Any]		    =  AutoTokenizer.from_pretrained('''google/mt5-small'''       )

    __a			:  Optional[int]		    =  tokenizer('''Hello there''' ,    return_tensors='''pt'''       ).input_ids
    __a			:  Dict		    =  tokenizer('''Hi I am''' ,    return_tensors='''pt'''       ).input_ids

    __a			:  Optional[Any]		    =  model(input_ids.to(snake_case_       ) ,    labels=labels.to(snake_case_       )       ).loss
    __a			:  Tuple		    =  -(labels.shape[-1] * loss.item())

    __a			:  Dict		    =  -84.9127
    self.assertTrue(abs(mtf_score - EXPECTED_SCORE       ) < 1E-4       )
