

'''simple docstring'''
class    a__  :


   def __init__( self			,				_UpperCamelCase  ):





      """simple docstring"""





      _lowercase			:      Any			     =   set_counts
      _lowercase			:      Optional[int]			     =   max(UpperCamelCase_  )
      _lowercase			:      List[Any]			     =   len(UpperCamelCase_  )
      _lowercase			:      Optional[int]			     =   [1] * num_sets
      _lowercase			:      List[Any]			     =   list(range(UpperCamelCase_  )  )


   def 						_lowerCamelCase   ( self			,				_UpperCamelCase			,				_UpperCamelCase  ):





      """simple docstring"""





      _lowercase			:      Union[str, Any]			     =   self.get_parent(UpperCamelCase_  )
      _lowercase			:      Optional[int]			     =   self.get_parent(UpperCamelCase_  )

      if src_parent == dst_parent:
         return False

      if self.ranks[dst_parent] >= self.ranks[src_parent]:
         self.set_counts[dst_parent] += self.set_counts[src_parent]
         _lowercase			:      Tuple			     =   0
         _lowercase			:      Dict			     =   dst_parent
         if self.ranks[dst_parent] == self.ranks[src_parent]:
            self.ranks[dst_parent] += 1
         _lowercase			:      Optional[int]			     =   self.set_counts[dst_parent]
      else:
         self.set_counts[src_parent] += self.set_counts[dst_parent]
         _lowercase			:      Tuple			     =   0
         _lowercase			:      str			     =   src_parent
         _lowercase			:      Optional[Any]			     =   self.set_counts[src_parent]

      _lowercase			:      Tuple			     =   max(self.max_set			,				UpperCamelCase_  )
      return True






   def 						_lowerCamelCase   ( self			,				_UpperCamelCase  ):





      """simple docstring"""





      if self.parents[disj_set] == disj_set:
         return disj_set
      _lowercase			:      Dict			     =   self.get_parent(self.parents[disj_set]  )
      return self.parents[disj_set]










'''simple docstring'''
from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt


def 			a      (			__a   )  ->	bool:



					'''simple docstring'''






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


def 			a      (			__a ,					__a ,					__a ,					__a ,					__a ,					__a   )  ->	tuple[int, int]:



					'''simple docstring'''






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


def 			a      (			__a = 35   )  ->	int:



					'''simple docstring'''






					UpperCamelCase__   :set												= set()
					UpperCamelCase__   :int
					UpperCamelCase__   :Fraction												= Fraction(0   )
					UpperCamelCase__   :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
																									UpperCamelCase__   :int												= x_num * y_den + x_den * y_num
																									UpperCamelCase__   :Any												= x_den * y_den
																									UpperCamelCase__   :Tuple												= gcd(__a ,					__a   )
																									z_num //= hcf
																									z_den //= hcf
																									if 0 < z_num < z_den <= order:
																														UpperCamelCase__   :Tuple												= add_three(
																														    __a ,					__a ,					__a ,					__a ,					__a ,					__a   )
																														unique_s.add(__a   )

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

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

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

					for num, den in unique_s:
										total += Fraction(__a ,					__a   )

					return total.denominator + total.numerator


if __name__ == "__main__":
		print(F"""{solution() = }""")