



from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt


def A						(       __UpperCamelCase					)						->      bool:
			A__       =    int(number**0.5					)
			return number == sq * sq


def A						(       __UpperCamelCase ,	__UpperCamelCase ,	__UpperCamelCase ,	__UpperCamelCase ,	__UpperCamelCase ,	__UpperCamelCase					)						->      tuple[int, int]:
			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 A						(       __UpperCamelCase = 35					)						->      int:
			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() = }')









def A						(       __UpperCamelCase					)						->      bool:
			return number & 1 == 0


if __name__ == "__main__":
							import doctest

							doctest.testmod()




