




'''simple docstring'''





import re
from pathlib import Path
from unittest import TestCase

import pytest




@pytest.mark.integration
class  _snake_case		(	lowercase_							):




			def    lowerCAmelCase__				(					self				,							a__							)				->				Dict:

										'''simple docstring'''




										with open(a__				,							encoding="utf-8"							) as input_file:
																	snake_case_						=      re.compile(r"(?!.*\b(?:encoding|rb|w|wb|w+|wb+|ab|ab+)\b)(?<=\s)(open)\((.*)\)"							)
																	snake_case_						=      input_file.read()
																	snake_case_						=      regexp.search(a__							)

										return match




			def    lowerCAmelCase__				(					self				,							a__							)				->				Tuple:

										'''simple docstring'''




										with open(a__				,							encoding="utf-8"							) as input_file:
																	snake_case_						=      re.compile(r"#[^\r\n]*print\(|\"[^\r\n]*print\(|\"\"\".*?print\(.*?\"\"\"|(print\()"				,							re.DOTALL							)
																	snake_case_						=      input_file.read()
																	# use `re.finditer` to handle the case where the ignored groups would be matched first by `re.search`
																	snake_case_						=      regexp.finditer(a__							)

										snake_case_						=      [match for match in matches if match is not None and match.group(1							) is not None]
										return matches[0] if matches else None




			def    lowerCAmelCase__				(					self							)				->				Dict:

										'''simple docstring'''




										snake_case_						=      Path("./datasets"							)
										snake_case_						=      list(dataset_paths.absolute().glob("**/*.py"							)							)

										for dataset in dataset_files:
																	if self._no_encoding_on_file_open(str(a__							)							):
																								raise AssertionError(F'open(...) must use utf-8 encoding in {dataset}'							)




			def    lowerCAmelCase__				(					self							)				->				Dict:

										'''simple docstring'''




										snake_case_						=      Path("./datasets"							)
										snake_case_						=      list(dataset_paths.absolute().glob("**/*.py"							)							)

										for dataset in dataset_files:
																	if self._no_print_statements(str(a__							)							):
																								raise AssertionError(F'print statement found in {dataset}. Use datasets.logger/logging instead.'							)






from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt




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




def    __UpperCamelCase     (				lowerCAmelCase__							:				int  ,   lowerCAmelCase__							:				int  ,   lowerCAmelCase__							:				int  ,   lowerCAmelCase__							:				int  ,   lowerCAmelCase__							:				int  ,   lowerCAmelCase__							:				int  ):
 __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__							:				int = 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 :  Any						=  x_num * y_den + x_den * y_num
     __a :  Dict						=  x_den * y_den
     __a :  int						=  gcd(lowerCAmelCase__  ,   lowerCAmelCase__  )
     z_num //= hcf
     z_den //= hcf
     if 0 < z_num < z_den <= order:
      __a :  str						=  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 :  Optional[Any]						=  x_den * x_den * y_den * y_den
     if is_sq(lowerCAmelCase__  ) and is_sq(lowerCAmelCase__  ):
      __a :  Any						=  int(sqrt(lowerCAmelCase__  )  )
      __a :  Optional[Any]						=  int(sqrt(lowerCAmelCase__  )  )
      __a :  int						=  gcd(lowerCAmelCase__  ,   lowerCAmelCase__  )
      z_num //= hcf
      z_den //= hcf
      if 0 < z_num < z_den <= order:
       __a :  str						=  add_three(
           lowerCAmelCase__  ,   lowerCAmelCase__  ,   lowerCAmelCase__  ,   lowerCAmelCase__  ,   lowerCAmelCase__  ,   lowerCAmelCase__  )
       unique_s.add(lowerCAmelCase__  )

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

     # n=2
     __a :  List[str]						=  x_num * x_num * y_num * y_num
     __a :  Optional[int]						=  (
         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 :  Union[str, Any]						=  int(sqrt(lowerCAmelCase__  )  )
      __a :  List[str]						=  int(sqrt(lowerCAmelCase__  )  )
      __a :  Optional[int]						=  gcd(lowerCAmelCase__  ,   lowerCAmelCase__  )
      z_num //= hcf
      z_den //= hcf
      if 0 < z_num < z_den <= order:
       __a :  int						=  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() = }""")
