





'''simple docstring'''
import timeit

class 					snake_case					:




 """simple docstring"""



 def __init__(	self	:							str							,     __A	:							int     ):






        if isinstance(SCREAMING_SNAKE_CASE_							,     SCREAMING_SNAKE_CASE_     ):  # Initializes a matrix identical to the one provided.
               __UpperCamelCase	=  arg
               __UpperCamelCase	=  len(SCREAMING_SNAKE_CASE_     )
        else:  # Initializes a square matrix of the given size and set values to zero.
               __UpperCamelCase	=  arg
               __UpperCamelCase	=  [[0 for _ in range(self.n     )] for _ in range(self.n     )]






 def __mul__(	self	:							Union[str, Any]							,     __A	:							Union[str, Any]     ):
        __UpperCamelCase	=  Matrix(self.n     )
        for i in range(self.n     ):
               for j in range(self.n     ):
                      for k in range(self.n     ):
                             matrix.t[i][j] += self.t[i][k] * b.t[k][j]
        return matrix






def     lowercase__       (       __lowercase						:  List[str]    ,  __lowercase						:  int					)			->				Optional[int]:



       """simple docstring"""






       __UpperCamelCase	=  Matrix([[1, 0], [0, 1]]					)
       while b > 0:
              if b & 1:
                     matrix *= a
              a *= a
              b >>= 1
       return matrix
def     lowercase__       (       __lowercase						:  List[Any]    ,  __lowercase						:  Optional[int]    ,  __lowercase						:  str					)			->				List[Any]:



       """simple docstring"""






       if n == 1:
              return fa
       elif n == 2:
              return fa
       __UpperCamelCase	=  Matrix([[1, 1], [1, 0]]					)
       __UpperCamelCase	=  modular_exponentiation(__lowercase    ,  n - 2					)
       return fa * matrix.t[0][0] + fa * matrix.t[0][1]
def     lowercase__       (       __lowercase						:  Union[str, Any]    ,  __lowercase						:  int    ,  __lowercase						:  Dict					)			->				str:



       """simple docstring"""






       if n == 1:
              return fa
       elif n == 2:
              return fa

       __UpperCamelCase	=  fa
       __UpperCamelCase	=  fa
       n -= 2

       while n > 0:
              __UpperCamelCase	,						__UpperCamelCase	=  fn_a + fn_a, fn_a
              n -= 1

       return fn_a
def     lowercase__       (       )			->				List[str]:



       """simple docstring"""






       __UpperCamelCase	=  '\nfrom random import randint\nfrom __main__ import fibonacci_with_matrix_exponentiation\n'
       __UpperCamelCase	=  'fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)'
       __UpperCamelCase	=  timeit.timeit(setup=__lowercase    ,  stmt=__lowercase    ,  number=100					)
       print('With matrix exponentiation the average execution time is '    ,  exec_time / 100					)
       return exec_time
def     lowercase__       (       )			->				Any:



       """simple docstring"""






       __UpperCamelCase	=  '\nfrom random import randint\nfrom __main__ import simple_fibonacci\n'
       __UpperCamelCase	=  'simple_fibonacci(randint(1,70000), 1, 1)'
       __UpperCamelCase	=  timeit.timeit(setup=__lowercase    ,  stmt=__lowercase    ,  number=100					)
       print(
           'Without matrix exponentiation the average execution time is '    ,  exec_time / 100					)
       return exec_time
def     lowercase__       (       )			->				List[str]:



       """simple docstring"""






       matrix_exponentiation_time()
       simple_fibonacci_time()


if __name__ == "__main__":
    main()











'''simple docstring'''
def     lowercase__       (       __lowercase						:  int = 20					)			->				int:



       """simple docstring"""






       try:
              __UpperCamelCase	=  int(__lowercase					)
       except (TypeError, ValueError):
              raise TypeError('Parameter n must be int or castable to int.'					)
       if n <= 0:
              raise ValueError('Parameter n must be greater than or equal to one.'					)
       __UpperCamelCase	=  0
       while 1:
              i += n * (n - 1)
              __UpperCamelCase	=  0
              for j in range(2    ,  __lowercase					):
                     if i % j != 0:
                            __UpperCamelCase	=  1
                            break
              if nfound == 0:
                     if i == 0:
                            __UpperCamelCase	=  1
                     return i
       return None


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