



from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt

def   _lowerCAmelCase   (						A__	):
      lowercase__     =  int(number**0.5	)
      return number == sq * sq

def   _lowerCAmelCase   (						A__						,  A__						,  A__						,  A__						,  A__						,  A__	):
      lowercase__     =  x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
      lowercase__     =  x_den * y_den * z_den
      lowercase__     =  gcd(lowerCAmelCase_						,  lowerCAmelCase_	)
      top //= hcf
      bottom //= hcf
      return top, bottom

def   _lowerCAmelCase   (						A__ = 35	):
      lowercase__     =  set()
      lowercase__     =  42
      lowercase__     =  Fraction(0	)
      lowercase__     =  42

      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
                              lowercase__     =  x_num * y_den + x_den * y_num
                              lowercase__     =  x_den * y_den
                              lowercase__     =  gcd(lowerCAmelCase_						,  lowerCAmelCase_	)
                              z_num //= hcf
                              z_den //= hcf
                              if 0 < z_num < z_den <= order:
                                    lowercase__     =  add_three(
                                        lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_	)
                                    unique_s.add(lowerCAmelCase_	)

                              # n=2
                              lowercase__     =  (
                                  x_num * x_num * y_den * y_den + x_den * x_den * y_num * y_num
                              )
                              lowercase__     =  x_den * x_den * y_den * y_den
                              if is_sq(lowerCAmelCase_	) and is_sq(lowerCAmelCase_	):
                                    lowercase__     =  int(sqrt(lowerCAmelCase_	)	)
                                    lowercase__     =  int(sqrt(lowerCAmelCase_	)	)
                                    lowercase__     =  gcd(lowerCAmelCase_						,  lowerCAmelCase_	)
                                    z_num //= hcf
                                    z_den //= hcf
                                    if 0 < z_num < z_den <= order:
                                          lowercase__     =  add_three(
                                              lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_	)
                                          unique_s.add(lowerCAmelCase_	)

                    # n=-1
                              lowercase__     =  x_num * y_num
                              lowercase__     =  x_den * y_num + x_num * y_den
                              lowercase__     =  gcd(lowerCAmelCase_						,  lowerCAmelCase_	)
                              z_num //= hcf
                              z_den //= hcf
                              if 0 < z_num < z_den <= order:
                                    lowercase__     =  add_three(
                                        lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_						,  lowerCAmelCase_	)
                                    unique_s.add(lowerCAmelCase_	)

                              # n=2
                              lowercase__     =  x_num * x_num * y_num * y_num
                              lowercase__     =  (
                                  x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
                              )
                              if is_sq(lowerCAmelCase_	) and is_sq(lowerCAmelCase_	):
                                    lowercase__     =  int(sqrt(lowerCAmelCase_	)	)
                                    lowercase__     =  int(sqrt(lowerCAmelCase_	)	)
                                    lowercase__     =  gcd(lowerCAmelCase_						,  lowerCAmelCase_	)
                                    z_num //= hcf
                                    z_den //= hcf
                                    if 0 < z_num < z_den <= order:
                                          lowercase__     =  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() = }''')











from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


a__      :				Optional[int]   	=			{
    "configuration_blenderbot": [
        "BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "BlenderbotConfig",
        "BlenderbotOnnxConfig",
    ],
    "tokenization_blenderbot": ["BlenderbotTokenizer"],
}

try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				Any   	=			["BlenderbotTokenizerFast"]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				Dict   	=			[
           "BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "BlenderbotForCausalLM",
           "BlenderbotForConditionalGeneration",
           "BlenderbotModel",
           "BlenderbotPreTrainedModel",
       ]


try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				List[str]   	=			[
           "TFBlenderbotForConditionalGeneration",
           "TFBlenderbotModel",
           "TFBlenderbotPreTrainedModel",
       ]


try:
       if not is_flax_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				int   	=			[
           "FlaxBlenderbotForConditionalGeneration",
           "FlaxBlenderbotModel",
           "FlaxBlenderbotPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_blenderbot import (
           BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP,
           BlenderbotConfig,
           BlenderbotOnnxConfig,
       )
       from .tokenization_blenderbot import BlenderbotTokenizer

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_blenderbot_fast import BlenderbotTokenizerFast

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_blenderbot import (
                  BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  BlenderbotForCausalLM,
                  BlenderbotForConditionalGeneration,
                  BlenderbotModel,
                  BlenderbotPreTrainedModel,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_blenderbot import (
                  TFBlenderbotForConditionalGeneration,
                  TFBlenderbotModel,
                  TFBlenderbotPreTrainedModel,
              )

       try:
              if not is_flax_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_flax_blenderbot import (
                  FlaxBlenderbotForConditionalGeneration,
                  FlaxBlenderbotModel,
                  FlaxBlenderbotPreTrainedModel,
              )

else:
       import sys

       a__      :				Optional[Any]   	=			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
