




'''simple docstring'''






import string

import numpy






def 		UpperCamelCase__      (		__SCREAMING_SNAKE_CASE				,      __SCREAMING_SNAKE_CASE		)    ->   int:
      return b if a == 0 else greatest_common_divisor(b % a				,      __SCREAMING_SNAKE_CASE		)






class        lowercase_      :
     A_											=			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)
     A_											=			numpy.vectorize(lambda lowerCAmelCase_							: x % 3_6							)

     A_											=			numpy.vectorize(lowerCAmelCase_							)





     def __init__(     self     :					Dict     ,							__lowerCamelCase     :					numpy.ndarray			):
           snake_case__       :   List[str]	      =    self.modulus(__lowerCamelCase			)  # mod36 calc's on the encrypt key
           self.check_determinant()  # validate the determinant of the encryption key
           snake_case__       :   Union[str, Any]	      =    encrypt_key.shape[0]





     def 			_lowerCAmelCase      (     self     :					List[str]     ,							__lowerCamelCase     :					str			):
           return self.key_string.index(__lowerCamelCase			)





     def 			_lowerCAmelCase      (     self     :					int     ,							__lowerCamelCase     :					int			):
           return self.key_string[round(__lowerCamelCase			)]





     def 			_lowerCAmelCase      (     self     :					List[str]			):
           snake_case__       :   Tuple	      =    round(numpy.linalg.det(self.encrypt_key			)			)

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

           snake_case__       :   str	      =    len(self.key_string			)
           if greatest_common_divisor(__lowerCamelCase     ,							len(self.key_string			)			) != 1:
                 snake_case__       :   List[Any]	      =    (
                     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 			_lowerCAmelCase      (     self     :					Dict     ,							__lowerCamelCase     :					str			):
           snake_case__       :   Optional[int]	      =    [char for char in text.upper() if char in self.key_string]

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

           return "".join(__lowerCamelCase			)





     def 			_lowerCAmelCase      (     self     :					str     ,							__lowerCamelCase     :					str			):
           snake_case__       :   Tuple	      =    self.process_text(text.upper()			)
           snake_case__       :   Optional[int]	      =    ''

           for i in range(0     ,							len(__lowerCamelCase			) - self.break_key + 1     ,							self.break_key			):
                 snake_case__       :   str	      =    text[i : i + self.break_key]
                 snake_case__       :   Optional[int]	      =    [self.replace_letters(__lowerCamelCase			) for char in batch]
                 snake_case__       :   List[str]	      =    numpy.array([vec]			).T
                 snake_case__       :   Dict	      =    self.modulus(self.encrypt_key.dot(__lowerCamelCase			)			).T.tolist()[
                     0
                 ]
                 snake_case__       :   Tuple	      =    ''.join(
                     self.replace_digits(__lowerCamelCase			) for num in batch_encrypted			)
                 encrypted += encrypted_batch

           return encrypted





     def 			_lowerCAmelCase      (     self     :					Tuple			):
           snake_case__       :   str	      =    round(numpy.linalg.det(self.encrypt_key			)			)

           if det < 0:
                 snake_case__       :   int	      =    det % len(self.key_string			)
           snake_case__       :   List[str]	      =    None
           for i in range(len(self.key_string			)			):
                 if (det * i) % len(self.key_string			) == 1:
                       snake_case__       :   int	      =    i
                       break

           snake_case__       :   int	      =    (
               det_inv
               * numpy.linalg.det(self.encrypt_key			)
               * numpy.linalg.inv(self.encrypt_key			)
           )

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





     def 			_lowerCAmelCase      (     self     :					Tuple     ,							__lowerCamelCase     :					str			):
           snake_case__       :   List[str]	      =    self.make_decrypt_key()
           snake_case__       :   Optional[int]	      =    self.process_text(text.upper()			)
           snake_case__       :   int	      =    ''

           for i in range(0     ,							len(__lowerCamelCase			) - self.break_key + 1     ,							self.break_key			):
                 snake_case__       :   Tuple	      =    text[i : i + self.break_key]
                 snake_case__       :   Union[str, Any]	      =    [self.replace_letters(__lowerCamelCase			) for char in batch]
                 snake_case__       :   Optional[Any]	      =    numpy.array([vec]			).T
                 snake_case__       :   int	      =    self.modulus(decrypt_key.dot(__lowerCamelCase			)			).T.tolist()[0]
                 snake_case__       :   Optional[Any]	      =    ''.join(
                     self.replace_digits(__lowerCamelCase			) for num in batch_decrypted			)
                 decrypted += decrypted_batch

           return decrypted






def 		UpperCamelCase__      (		)    ->   None:
      snake_case__       :   Optional[Any]	      =    int(input('Enter the order of the encryption key: '		)		)
      snake_case__       :   int	      =    []

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

      snake_case__       :   Dict	      =    HillCipher(numpy.array(__SCREAMING_SNAKE_CASE		)		)

      print('Would you like to encrypt or decrypt some text? (1 or 2)'		)
      snake_case__       :   List[Any]	      =    input('\n1. Encrypt\n2. Decrypt\n'		)
      if option == "1":
            snake_case__       :   int	      =    input('What text would you like to encrypt?: '		)
            print('Your encrypted text is:'		)
            print(hc.encrypt(__SCREAMING_SNAKE_CASE		)		)
      elif option == "2":
            snake_case__       :   List[Any]	      =    input('What text would you like to decrypt?: '		)
            print('Your decrypted text is:'		)
            print(hc.decrypt(__SCREAMING_SNAKE_CASE		)		)


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      main()






'''simple docstring'''






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

            return sequence[n]






def 		UpperCamelCase__      (		__SCREAMING_SNAKE_CASE		)    ->   int:
      snake_case__       :   Optional[int]	      =    0
      snake_case__       :   Dict	      =    2

      while digits < n:
            index += 1
            snake_case__       :   Optional[int]	      =    len(str(fibonacci(__SCREAMING_SNAKE_CASE		)		)		)

      return index






def 		UpperCamelCase__      (		__SCREAMING_SNAKE_CASE = 1000		)    ->   int:
      return fibonacci_digits_index(__SCREAMING_SNAKE_CASE		)


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