


'''simple docstring'''



import numpy as np

__UpperCAmelCase    :Any				       =     [
    ["a", "b", "c", "d", "e"],
    ["f", "g", "h", "i", "k"],
    ["l", "m", "n", "o", "p"],
    ["q", "r", "s", "t", "u"],
    ["v", "w", "x", "y", "z"],
]



class 			a       :


     """simple docstring"""






     def __init__(       self  :	List[str]    )		->							None:
          __UpperCAmelCase			:				int													=    np.array(snake_case    )

     def 				lowerCamelCase__				(       self  :	List[Any]							,				snake_case  :	str    )		->							np.ndarray:
          __UpperCAmelCase			:				Tuple													=    np.where(letter == self.SQUARE    )
          __UpperCAmelCase			:				str													=    np.concatenate([indexa + 1, indexa + 1]    )
          return indexes

     def 				lowerCamelCase__				(       self  :	Any							,				snake_case  :	int							,				snake_case  :	int    )		->							str:
          __UpperCAmelCase			:				Any													=    self.SQUARE[indexa - 1, indexa - 1]
          return letter

     def 				lowerCamelCase__				(       self  :	str							,				snake_case  :	str    )		->							str:
          __UpperCAmelCase			:				int													=    message.lower()
          __UpperCAmelCase			:				Optional[int]													=    message.replace(''' '''							,				''''''    )
          __UpperCAmelCase			:				List[str]													=    message.replace('''j'''							,				'''i'''    )

          __UpperCAmelCase			:				Union[str, Any]													=    np.empty((2, len(snake_case    ))    )
          for letter_index in range(len(snake_case    )    ):
               __UpperCAmelCase			:				str													=    self.letter_to_numbers(message[letter_index]    )

               __UpperCAmelCase			:				Tuple													=    numbers[0]
               __UpperCAmelCase			:				Union[str, Any]													=    numbers[1]

          __UpperCAmelCase			:				List[str]													=    first_step.reshape(2 * len(snake_case    )    )
          __UpperCAmelCase			:				Any													=    ''''''
          for numbers_index in range(len(snake_case    )    ):
               __UpperCAmelCase			:				Any													=    int(second_step[numbers_index * 2]    )
               __UpperCAmelCase			:				int													=    int(second_step[(numbers_index * 2) + 1]    )
               __UpperCAmelCase			:				str													=    self.numbers_to_letter(snake_case							,				snake_case    )
               __UpperCAmelCase			:				int													=    encoded_message + letter

          return encoded_message






     def 				lowerCamelCase__				(       self  :	Union[str, Any]							,				snake_case  :	str    )		->							str:
          __UpperCAmelCase			:				Dict													=    message.lower()
          message.replace(''' '''							,				''''''    )
          __UpperCAmelCase			:				List[Any]													=    np.empty(2 * len(snake_case    )    )
          for letter_index in range(len(snake_case    )    ):
               __UpperCAmelCase			:				List[str]													=    self.letter_to_numbers(message[letter_index]    )
               __UpperCAmelCase			:				Dict													=    numbers[0]
               __UpperCAmelCase			:				str													=    numbers[1]

          __UpperCAmelCase			:				Optional[Any]													=    first_step.reshape((2, len(snake_case    ))    )
          __UpperCAmelCase			:				Optional[Any]													=    ''''''
          for numbers_index in range(len(snake_case    )    ):
               __UpperCAmelCase			:				Dict													=    int(second_step[0, numbers_index]    )
               __UpperCAmelCase			:				Any													=    int(second_step[1, numbers_index]    )
               __UpperCAmelCase			:				Any													=    self.numbers_to_letter(snake_case							,				snake_case    )
               __UpperCAmelCase			:				List[str]													=    decoded_message + letter

          return decoded_message



'''simple docstring'''



from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt




def 			_a			(		_lowercase      :			int						):





     '''simple docstring'''






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




def 			_a			(		_lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			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(_lowercase    ,      _lowercase						)
     top //= hcf
     bottom //= hcf
     return top, bottom




def 			_a			(		_lowercase      :			int = 35						):





     '''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			:				Optional[int]													=    x_num * y_den + x_den * y_num
                         __UpperCAmelCase			:				Dict													=    x_den * y_den
                         __UpperCAmelCase			:				List[Any]													=    gcd(_lowercase    ,      _lowercase						)
                         z_num //= hcf
                         z_den //= hcf
                         if 0 < z_num < z_den <= order:
                              __UpperCAmelCase			:				Dict													=    add_three(
                                  _lowercase    ,      _lowercase    ,      _lowercase    ,      _lowercase    ,      _lowercase    ,      _lowercase						)
                              unique_s.add(_lowercase						)

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

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

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

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

     return total.denominator + total.numerator


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