



from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt






def 				A				(					_lowerCamelCase  ):





							'''simple docstring'''




							_lowerCAmelCase     :							Tuple    =    int(number**0.5  )
							return number == sq * sq






def 				A				(					_lowerCamelCase				, _lowerCamelCase				, _lowerCamelCase				, _lowerCamelCase				, _lowerCamelCase				, _lowerCamelCase  ):





							'''simple docstring'''




							_lowerCAmelCase     :							str    =    x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
							_lowerCAmelCase     :							List[str]    =    x_den * y_den * z_den
							_lowerCAmelCase     :							Optional[Any]    =    gcd(A__				, A__  )
							top //= hcf
							bottom //= hcf
							return top, bottom






def 				A				(					_lowerCamelCase = 35  ):





							'''simple docstring'''




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

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

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

																																			# n=2
																																			_lowerCAmelCase     :							Dict    =    x_num * x_num * y_num * y_num
																																			_lowerCAmelCase     :							Optional[int]    =    (
																																			    x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
																																			)
																																			if is_sq(A__  ) and is_sq(A__  ):
																																										_lowerCAmelCase     :							str    =    int(sqrt(A__  )  )
																																										_lowerCAmelCase     :							Optional[Any]    =    int(sqrt(A__  )  )
																																										_lowerCAmelCase     :							Optional[Any]    =    gcd(A__				, A__  )
																																										z_num //= hcf
																																										z_den //= hcf
																																										if 0 < z_num < z_den <= order:
																																																	_lowerCAmelCase     :							Optional[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() = }''')





'''simple docstring'''


import math

class  SCREAMING_SNAKE_CASE :






    """simple docstring"""





    def __init__(  self      :					Union[str, Any]  ,						UpperCamelCase__      :					Optional[Any]=0 ):  # a graph with Node 0,1,...,N-1


       """simple docstring"""







       UpperCamelCase					=  n
       UpperCamelCase					=  [
           [math.inf for j in range(0  ,						UpperCamelCase__ )] for i in range(0  ,						UpperCamelCase__ )
       ]  # adjacency matrix for weight
       UpperCamelCase					=  [
           [math.inf for j in range(0  ,						UpperCamelCase__ )] for i in range(0  ,						UpperCamelCase__ )
       ]  # dp[i][j] stores minimum distance from i to j






    def  A       (  self      :					Optional[Any]  ,						UpperCamelCase__      :					Union[str, Any]  ,						UpperCamelCase__      :					Union[str, Any]  ,						UpperCamelCase__      :					Tuple ):


       """simple docstring"""







       UpperCamelCase					=  w






    def  A       (  self      :					str ):


       """simple docstring"""







       for k in range(0  ,						self.n ):
          for i in range(0  ,						self.n ):
             for j in range(0  ,						self.n ):
                UpperCamelCase					=  min(self.dp[i][j]  ,						self.dp[i][k] + self.dp[k][j] )






    def  A       (  self      :					Optional[Any]  ,						UpperCamelCase__      :					str  ,						UpperCamelCase__      :					List[Any] ):


       """simple docstring"""







       return self.dp[u][v]


if __name__ == "__main__":
   _lowerCamelCase	:       List[str]      	=	Graph(5)
   graph.add_edge(0, 2, 9)
   graph.add_edge(0, 4, 10)
   graph.add_edge(1, 3, 5)
   graph.add_edge(2, 3, 7)
   graph.add_edge(3, 0, 10)
   graph.add_edge(3, 1, 2)
   graph.add_edge(3, 2, 1)
   graph.add_edge(3, 4, 6)
   graph.add_edge(4, 1, 3)
   graph.add_edge(4, 2, 4)
   graph.add_edge(4, 3, 9)
   graph.floyd_warshall()
   graph.show_min(1, 4)
   graph.show_min(0, 3)

