



"""simple docstring"""







def     UpperCamelCase_   (   lowerCAmelCase__				:    list   ,       lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    int = 0   ,       lowerCAmelCase__				:    int = 0						)						->       int:

  """simple docstring"""




  lowerCAmelCase_       :    int								=			right or len(lowerCAmelCase__						) - 1
  if left > right:
    return -1
  elif list_data[left] == key:
    return left
  elif list_data[right] == key:
    return right
  else:
    return search(lowerCAmelCase__   ,       lowerCAmelCase__   ,       left + 1   ,       right - 1						)


if __name__ == "__main__":
     import doctest

     doctest.testmod()










"""simple docstring"""







from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt

def     UpperCamelCase_   (   lowerCAmelCase__				:    int						)						->       bool:

  """simple docstring"""




  lowerCAmelCase_       :    int								=			int(number**0.5						)
  return number == sq * sq

def     UpperCamelCase_   (   lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    int   ,       lowerCAmelCase__				:    int						)						->       tuple[int, int]:

  """simple docstring"""




  lowerCAmelCase_       :    int								=			x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
  lowerCAmelCase_       :    int								=			x_den * y_den * z_den
  lowerCAmelCase_       :    int								=			gcd(lowerCAmelCase__   ,       lowerCAmelCase__						)
  top //= hcf
  bottom //= hcf
  return top, bottom

def     UpperCamelCase_   (   lowerCAmelCase__				:    int = 35						)						->       int:

  """simple docstring"""




  lowerCAmelCase_       :    set								=			set()
  lowerCAmelCase_       :    int
  lowerCAmelCase_       :    Fraction								=			Fraction(0						)
  lowerCAmelCase_       :    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
          lowerCAmelCase_       :    str								=			x_num * y_den + x_den * y_num
          lowerCAmelCase_       :    int								=			x_den * y_den
          lowerCAmelCase_       :    int								=			gcd(lowerCAmelCase__   ,       lowerCAmelCase__						)
          z_num //= hcf
          z_den //= hcf
          if 0 < z_num < z_den <= order:
            lowerCAmelCase_       :    List[str]								=			add_three(
                lowerCAmelCase__   ,       lowerCAmelCase__   ,       lowerCAmelCase__   ,       lowerCAmelCase__   ,       lowerCAmelCase__   ,       lowerCAmelCase__						)
            unique_s.add(lowerCAmelCase__						)

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

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

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





