


import string

import numpy
def 	_UpperCamelCase					(    lowerCAmelCase_	,    lowerCAmelCase_ )    ->int:
   return b if a == 0 else greatest_common_divisor(b % a	,    lowerCAmelCase_ )






class 	__lowercase					:
      UpperCamelCase										=							string.ascii_uppercase + string.digits
      # This cipher takes alphanumerics into account
      # i.e. a total of 36 characters

      # take x and return x % len(key_string)
      UpperCamelCase										=							numpy.vectorize(lambda __snake_case	: x % 36	)

      UpperCamelCase										=							numpy.vectorize(__snake_case	)





      def __init__(		self    :       Union[str, Any]       ,							__lowerCamelCase    :       numpy.ndarray							)     -> None:






         """simple docstring"""







         UpperCAmelCase      					=  self.modulus(__lowerCamelCase							)  # mod36 calc's on the encrypt key
         self.check_determinant()  # validate the determinant of the encryption key
         UpperCAmelCase      					=  encrypt_key.shape[0]





      def 							_lowercase					(		self    :       List[str]       ,							__lowerCamelCase    :       str							)     -> int:






         """simple docstring"""







         return self.key_string.index(__lowerCamelCase							)





      def 							_lowercase					(		self    :       str       ,							__lowerCamelCase    :       int							)     -> str:






         """simple docstring"""







         return self.key_string[round(__lowerCamelCase							)]





      def 							_lowercase					(		self    :       Optional[Any]							)     -> None:






         """simple docstring"""







         UpperCAmelCase      					=  round(numpy.linalg.det(self.encrypt_key							)							)

         if det < 0:
            UpperCAmelCase      					=  det % len(self.key_string							)

         UpperCAmelCase      					=  len(self.key_string							)
         if greatest_common_divisor(__lowerCamelCase       ,							len(self.key_string							)							) != 1:
            UpperCAmelCase      					=  (
                F"""determinant modular {req_l} of encryption key({det}) """
                F"""is not co prime w.r.t {req_l}.\nTry another key."""
            )
            raise ValueError(__lowerCamelCase							)





      def 							_lowercase					(		self    :       Dict       ,							__lowerCamelCase    :       str							)     -> str:






         """simple docstring"""







         UpperCAmelCase      					=  [char for char in text.upper() if char in self.key_string]

         UpperCAmelCase      					=  chars[-1]
         while len(__lowerCamelCase							) % self.break_key != 0:
            chars.append(__lowerCamelCase							)

         return "".join(__lowerCamelCase							)





      def 							_lowercase					(		self    :       int       ,							__lowerCamelCase    :       str							)     -> str:






         """simple docstring"""







         UpperCAmelCase      					=  self.process_text(text.upper()							)
         UpperCAmelCase      					=  """"""

         for i in range(0       ,							len(__lowerCamelCase							) - self.break_key + 1       ,							self.break_key							):
            UpperCAmelCase      					=  text[i : i + self.break_key]
            UpperCAmelCase      					=  [self.replace_letters(__lowerCamelCase							) for char in batch]
            UpperCAmelCase      					=  numpy.array([vec]							).T
            UpperCAmelCase      					=  self.modulus(self.encrypt_key.dot(__lowerCamelCase							)							).T.tolist()[
                0
            ]
            UpperCAmelCase      					=  """""".join(
                self.replace_digits(__lowerCamelCase							) for num in batch_encrypted							)
            encrypted += encrypted_batch

         return encrypted





      def 							_lowercase					(		self    :       Any							)     -> numpy.ndarray:






         """simple docstring"""







         UpperCAmelCase      					=  round(numpy.linalg.det(self.encrypt_key							)							)

         if det < 0:
            UpperCAmelCase      					=  det % len(self.key_string							)
         UpperCAmelCase      					=  None
         for i in range(len(self.key_string							)							):
            if (det * i) % len(self.key_string							) == 1:
               UpperCAmelCase      					=  i
               break

         UpperCAmelCase      					=  (
             det_inv
             * numpy.linalg.det(self.encrypt_key							)
             * numpy.linalg.inv(self.encrypt_key							)
         )

         return self.to_int(self.modulus(__lowerCamelCase							)							)





      def 							_lowercase					(		self    :       List[Any]       ,							__lowerCamelCase    :       str							)     -> str:






         """simple docstring"""







         UpperCAmelCase      					=  self.make_decrypt_key()
         UpperCAmelCase      					=  self.process_text(text.upper()							)
         UpperCAmelCase      					=  """"""

         for i in range(0       ,							len(__lowerCamelCase							) - self.break_key + 1       ,							self.break_key							):
            UpperCAmelCase      					=  text[i : i + self.break_key]
            UpperCAmelCase      					=  [self.replace_letters(__lowerCamelCase							) for char in batch]
            UpperCAmelCase      					=  numpy.array([vec]							).T
            UpperCAmelCase      					=  self.modulus(decrypt_key.dot(__lowerCamelCase							)							).T.tolist()[0]
            UpperCAmelCase      					=  """""".join(
                self.replace_digits(__lowerCamelCase							) for num in batch_decrypted							)
            decrypted += decrypted_batch

         return decrypted

def 	_UpperCamelCase					(    )    ->None:
   UpperCAmelCase      					=  int(input("""Enter the order of the encryption key: """ ) )
   UpperCAmelCase      					=  []

   print("""Enter each row of the encryption key with space separated integers""" )
   for _ in range(lowerCAmelCase_ ):
      UpperCAmelCase      					=  [int(lowerCAmelCase_ ) for x in input().split()]
      hill_matrix.append(lowerCAmelCase_ )

   UpperCAmelCase      					=  HillCipher(numpy.array(lowerCAmelCase_ ) )

   print("""Would you like to encrypt or decrypt some text? (1 or 2)""" )
   UpperCAmelCase      					=  input("""\n1. Encrypt\n2. Decrypt\n""" )
   if option == "1":
      UpperCAmelCase      					=  input("""What text would you like to encrypt?: """ )
      print("""Your encrypted text is:""" )
      print(hc.encrypt(lowerCAmelCase_ ) )
   elif option == "2":
      UpperCAmelCase      					=  input("""What text would you like to decrypt?: """ )
      print("""Your decrypted text is:""" )
      print(hc.decrypt(lowerCAmelCase_ ) )


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 main()







def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->int:
   if n == 1 or not isinstance(lowerCAmelCase_	,    lowerCAmelCase_ ):
      return 0
   elif n == 2:
      return 1
   else:
      UpperCAmelCase      					=  [0, 1]
      for i in range(2	,    n + 1 ):
         sequence.append(sequence[i - 1] + sequence[i - 2] )

      return sequence[n]
def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->int:
   UpperCAmelCase      					=  0
   UpperCAmelCase      					=  2

   while digits < n:
      index += 1
      UpperCAmelCase      					=  len(str(fibonacci(lowerCAmelCase_ ) ) )

   return index
def 	_UpperCamelCase					(    lowerCAmelCase_ = 1_0_0_0 )    ->int:
   return fibonacci_digits_index(lowerCAmelCase_ )


if __name__ == "__main__":
 print(solution(int(str(input()).strip())))



