



from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt





def 					__snake_case     (      _UpperCAmelCase    ):
    __a							=    int(number**0.5    )
    return number == sq * sq





def 					__snake_case     (      _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase    ):
    __a							=    x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
    __a							=    x_den * y_den * z_den
    __a							=    gcd(_UpperCAmelCase       ,			_UpperCAmelCase    )
    top //= hcf
    bottom //= hcf
    return top, bottom





def 					__snake_case     (      _UpperCAmelCase = 35    ):
    __a							=    set()
    __a							=    42
    __a							=    Fraction(0    )
    __a							=    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
                    __a							=    x_num * y_den + x_den * y_num
                    __a							=    x_den * y_den
                    __a							=    gcd(_UpperCAmelCase       ,			_UpperCAmelCase    )
                    z_num //= hcf
                    z_den //= hcf
                    if 0 < z_num < z_den <= order:
                        __a							=    add_three(
                            _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase    )
                        unique_s.add(_UpperCAmelCase    )

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

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

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

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

    return total.denominator + total.numerator


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










from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__snake_case						:Tuple						=					{
    '''configuration_luke''': ['''LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LukeConfig'''],
    '''tokenization_luke''': ['''LukeTokenizer'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __snake_case						:Optional[int]						=					[
     '''LUKE_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''LukeForEntityClassification''',
     '''LukeForEntityPairClassification''',
     '''LukeForEntitySpanClassification''',
     '''LukeForMultipleChoice''',
     '''LukeForQuestionAnswering''',
     '''LukeForSequenceClassification''',
     '''LukeForTokenClassification''',
     '''LukeForMaskedLM''',
     '''LukeModel''',
     '''LukePreTrainedModel''',
 ]


if TYPE_CHECKING:
 from .configuration_luke import LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP, LukeConfig
 from .tokenization_luke import LukeTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_luke import (
      LUKE_PRETRAINED_MODEL_ARCHIVE_LIST,
      LukeForEntityClassification,
      LukeForEntityPairClassification,
      LukeForEntitySpanClassification,
      LukeForMaskedLM,
      LukeForMultipleChoice,
      LukeForQuestionAnswering,
      LukeForSequenceClassification,
      LukeForTokenClassification,
      LukeModel,
      LukePreTrainedModel,
  )

else:
 import sys

 __snake_case						:Dict						=					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





