


from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt






def  UpperCamelCase					(	__magic_name__     :							Union[str, Any]     )   ->  bool:
		"""simple docstring"""




		lowercase__     			=		int(number**0.5     )
		return number == sq * sq






def  UpperCamelCase					(	__magic_name__     :							List[Any]    ,    __magic_name__     :							Dict    ,    __magic_name__     :							Optional[int]    ,    __magic_name__     :							List[str]    ,    __magic_name__     :							List[Any]    ,    __magic_name__     :							Tuple     )   ->  tuple[int, int]:
		"""simple docstring"""




		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  UpperCamelCase					(	__magic_name__     :							int = 35     )   ->  int:
		"""simple docstring"""




		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() = }')








def 		A_				(     _lowerCAmelCase     )						-> str:
 UpperCamelCase	:					Optional[int]       	=   int(_lowerCAmelCase     )
 if decimal in (0, 1):  # Exit cases for the recursion
  return str(_lowerCAmelCase     )
 UpperCamelCase	,    UpperCamelCase	:					Dict       	=   divmod(_lowerCAmelCase							,   2     )
 return binary_recursive(_lowerCAmelCase     ) + str(_lowerCAmelCase     )



def 		A_				(     _lowerCAmelCase     )						-> str:
 UpperCamelCase	:					Tuple       	=   str(_lowerCAmelCase     ).strip()
 if not number:
  raise ValueError("No input value was provided"     )
 UpperCamelCase	:					Optional[int]       	=   "-" if number.startswith("-"     ) else ""
 UpperCamelCase	:					Any       	=   number.lstrip("-"     )
 if not number.isnumeric():
  raise ValueError("Input value is not an integer"     )
 return F"""{negative}0b{binary_recursive(int(_lowerCAmelCase     )     )}"""


if __name__ == "__main__":
    from doctest import testmod

    testmod()
