


from __future__ import annotations


class   a__	:

       def __init__(   self      :     Optional[int]      ,							lowerCamelCase_      :     int = 0    ):
            a_    :     str										=    key

       def 						UpperCAmelCase(   self      :     Optional[Any]      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     int    ):
            assert isinstance(lowerCamelCase_      ,							lowerCamelCase_    ) and isinstance(lowerCamelCase_      ,							lowerCamelCase_    )

            a_    :     Tuple										=    key or self.__key or 1

            # make sure key is an appropriate size
            key %= 2_5_5

            return [chr(ord(lowerCamelCase_    ) ^ key    ) for ch in content]

       def 						UpperCAmelCase(   self      :     List[str]      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     int    ):
            assert isinstance(lowerCamelCase_      ,							lowerCamelCase_    ) and isinstance(lowerCamelCase_      ,							lowerCamelCase_    )

            a_    :     str										=    key or self.__key or 1

            # make sure key is an appropriate size
            key %= 2_5_5

            return [chr(ord(lowerCamelCase_    ) ^ key    ) for ch in content]

       def 						UpperCAmelCase(   self      :     List[Any]      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     int = 0    ):
            assert isinstance(lowerCamelCase_      ,							lowerCamelCase_    ) and isinstance(lowerCamelCase_      ,							lowerCamelCase_    )

            a_    :     Optional[int]										=    key or self.__key or 1

            # make sure key can be any size
            while key > 2_5_5:
                 key -= 2_5_5

            # This will be returned
            a_    :     Optional[int]										=    """"""

            for ch in content:
                 ans += chr(ord(lowerCamelCase_    ) ^ key    )

            return ans

       def 						UpperCAmelCase(   self      :     int      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     int = 0    ):
            assert isinstance(lowerCamelCase_      ,							lowerCamelCase_    ) and isinstance(lowerCamelCase_      ,							lowerCamelCase_    )

            a_    :     List[Any]										=    key or self.__key or 1

            # make sure key can be any size
            while key > 2_5_5:
                 key -= 2_5_5

            # This will be returned
            a_    :     Dict										=    """"""

            for ch in content:
                 ans += chr(ord(lowerCamelCase_    ) ^ key    )

            return ans

       def 						UpperCAmelCase(   self      :     int      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     int = 0    ):
            assert isinstance(lowerCamelCase_      ,							lowerCamelCase_    ) and isinstance(lowerCamelCase_      ,							lowerCamelCase_    )

            try:
                 with open(lowerCamelCase_    ) as fin, open("""encrypt.out"""      ,							"""w+"""    ) as fout:
                      # actual encrypt-process
                      for line in fin:
                           fout.write(self.encrypt_string(lowerCamelCase_      ,							lowerCamelCase_    )    )

            except OSError:
                 return False

            return True

       def 						UpperCAmelCase(   self      :     List[Any]      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     int    ):
            assert isinstance(lowerCamelCase_      ,							lowerCamelCase_    ) and isinstance(lowerCamelCase_      ,							lowerCamelCase_    )

            try:
                 with open(lowerCamelCase_    ) as fin, open("""decrypt.out"""      ,							"""w+"""    ) as fout:
                      # actual encrypt-process
                      for line in fin:
                           fout.write(self.decrypt_string(lowerCamelCase_      ,							lowerCamelCase_    )    )

            except OSError:
                 return False

            return True


# Tests
# crypt = XORCipher()
# key = 67

# # test encrypt
# print(crypt.encrypt("hallo welt",key))
# # test decrypt
# print(crypt.decrypt(crypt.encrypt("hallo welt",key), key))

# # test encrypt_string
# print(crypt.encrypt_string("hallo welt",key))

# # test decrypt_string
# print(crypt.decrypt_string(crypt.encrypt_string("hallo welt",key),key))

# if (crypt.encrypt_file("test.txt",key)):
#       print("encrypt successful")
# else:
#       print("encrypt unsuccessful")

# if (crypt.decrypt_file("encrypt.out",key)):
#       print("decrypt successful")
# else:
#       print("decrypt unsuccessful")







from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt



def  _a			(						__UpperCamelCase ):
     a_    :     int										=    int(number**0.5 )
     return number == sq * sq



def  _a			(						__UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase ):
     a_    :     int										=    x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
     a_    :     int										=    x_den * y_den * z_den
     a_    :     int										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
     top //= hcf
     bottom //= hcf
     return top, bottom



def  _a			(						__UpperCamelCase = 3_5 ):
     a_    :     set										=    set()
     a_    :     int
     a_    :     Fraction										=    Fraction(0 )
     a_    :     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
                         a_    :     int										=    x_num * y_den + x_den * y_num
                         a_    :     Optional[int]										=    x_den * y_den
                         a_    :     Optional[Any]										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
                         z_num //= hcf
                         z_den //= hcf
                         if 0 < z_num < z_den <= order:
                              a_    :     Optional[int]										=    add_three(
                                  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase )
                              unique_s.add(__UpperCamelCase )

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

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

                         # n=2
                         a_    :     Union[str, Any]										=    x_num * x_num * y_num * y_num
                         a_    :     Dict										=    (
                             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_    :     Dict										=    int(sqrt(__UpperCamelCase ) )
                              a_    :     Union[str, Any]										=    int(sqrt(__UpperCamelCase ) )
                              a_    :     Dict										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
                              z_num //= hcf
                              z_den //= hcf
                              if 0 < z_num < z_den <= order:
                                   a_    :     List[Any]										=    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() = }''')



