






from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt






def 					lowerCamelCase__					(_UpperCAmelCase):
			SCREAMING_SNAKE_CASE							=			int(number**0.5)
			return number == sq * sq






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






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

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

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

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












def        _snake_case   (_snake_case				:       list      ,    _snake_case				:       int      ,    _snake_case				:       int = 0      ,    _snake_case				:       int = 0)					->	int:
   _lowercase              =right or len(_snake_case) - 1
   if left > right:
      return -1
   elif list_data[left] == key:
      return left
   elif list_data[right] == key:
      return right
   else:
      return search(_snake_case      ,    _snake_case      ,    left + 1      ,    right - 1)


if __name__ == "__main__":
    import doctest

    doctest.testmod()


