"""simple docstring"""



import mpmath  # for roots of unity
import numpy as np






class 	__lowerCAmelCase					:




    '''simple docstring'''






    def __init__(     self				:	List[str]					,				UpperCamelCase__				:	Optional[int]=None					,				UpperCamelCase__				:	Optional[Any]=None							):
          # Input as list
          A__	:      List[Any]      =list(poly_a or [0]							)[:]
          A__	:      Tuple      =list(poly_b or [0]							)[:]

          # Remove leading zero coefficients
          while self.polyA[-1] == 0:
                self.polyA.pop()
          A__	:      Dict      =len(self.polyA							)

          while self.polyB[-1] == 0:
                self.polyB.pop()
          A__	:      Tuple      =len(self.polyB							)

          # Add 0 to make lengths equal a power of 2
          A__	:      Optional[int]      =int(
              2 ** np.ceil(np.loga(len(self.polyA							) + len(self.polyB							) - 1							)							)							)

          while len(self.polyA							) < self.c_max_length:
                self.polyA.append(0							)
          while len(self.polyB							) < self.c_max_length:
                self.polyB.append(0							)
          # A complex root used for the fourier transform
          A__	:      List[Any]      =complex(mpmath.root(x=1					,				n=self.c_max_length					,				k=1							)							)

          # The product
          A__	:      Optional[Any]      =self.__multiply()





    def 					_UpperCAmelCase		(     self				:	Optional[int]					,				UpperCamelCase__				:	List[str]							):
          A__	:      Tuple      =[[x] for x in self.polyA] if which == """A""" else [[x] for x in self.polyB]
          # Corner case
          if len(__snake_case							) <= 1:
                return dft[0]
          #
          A__	:      Optional[int]      =self.c_max_length // 2
          while next_ncol > 0:
                A__	:      Optional[int]      =[[] for i in range(__snake_case							)]
                A__	:      Optional[int]      =self.root**next_ncol

                # First half of next step
                A__	:      Optional[Any]      =1
                for j in range(self.c_max_length // (next_ncol * 2)							):
                      for i in range(__snake_case							):
                            new_dft[i].append(dft[i][j] + current_root * dft[i + next_ncol][j]							)
                      current_root *= root
                # Second half of next step
                A__	:      List[Any]      =1
                for j in range(self.c_max_length // (next_ncol * 2)							):
                      for i in range(__snake_case							):
                            new_dft[i].append(dft[i][j] - current_root * dft[i + next_ncol][j]							)
                      current_root *= root
                # Update
                A__	:      Union[str, Any]      =new_dft
                A__	:      Tuple      =next_ncol // 2
          return dft[0]





    def 					_UpperCAmelCase		(     self				:	int							):
          A__	:      Optional[Any]      =self.__dft("A"							)
          A__	:      Optional[int]      =self.__dft("B"							)
          A__	:      List[Any]      =[[dft_a[i] * dft_b[i] for i in range(self.c_max_length							)]]
          del dft_a
          del dft_b

          # Corner Case
          if len(inverce_c[0]							) <= 1:
                return inverce_c[0]
          # Inverse DFT
          A__	:      List[str]      =2
          while next_ncol <= self.c_max_length:
                A__	:      List[str]      =[[] for i in range(__snake_case							)]
                A__	:      List[str]      =self.root ** (next_ncol // 2)
                A__	:      Optional[int]      =1
                # First half of next step
                for j in range(self.c_max_length // next_ncol							):
                      for i in range(next_ncol // 2							):
                            # Even positions
                            new_inverse_c[i].append(
                                (
                                    inverce_c[i][j]
                                    + inverce_c[i][j + self.c_max_length // next_ncol]
                                )
                                / 2							)
                            # Odd positions
                            new_inverse_c[i + next_ncol // 2].append(
                                (
                                    inverce_c[i][j]
                                    - inverce_c[i][j + self.c_max_length // next_ncol]
                                )
                                / (2 * current_root)							)
                      current_root *= root
                # Update
                A__	:      Any      =new_inverse_c
                next_ncol *= 2
          # Unpack
          A__	:      int      =[round(x[0].real					,				8							) + round(x[0].imag					,				8							) * 1j for x in inverce_c]

          # Remove leading 0's
          while inverce_c[-1] == 0:
                inverce_c.pop()
          return inverce_c





    def __str__(     self				:	Dict							):
          A__	:      Optional[int]      ="""A = """ + """ + """.join(
              F'''{coef}*x^{i}''' for coef, i in enumerate(self.polyA[: self.len_A]							)							)
          A__	:      Union[str, Any]      ="""B = """ + """ + """.join(
              F'''{coef}*x^{i}''' for coef, i in enumerate(self.polyB[: self.len_B]							)							)
          A__	:      str      ="""A*B = """ + """ + """.join(
              F'''{coef}*x^{i}''' for coef, i in enumerate(self.product							)							)

          return F'''{a}\n{b}\n{c}'''


# Unit tests
if __name__ == "__main__":
  import doctest

  doctest.testmod()









'''simple docstring'''


from __future__ import annotations







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				if len(SCREAMING_SNAKE_CASE__	) <= 1 or n <= 1:
								return

				insert_next(SCREAMING_SNAKE_CASE__				, n - 1	)
				rec_insertion_sort(SCREAMING_SNAKE_CASE__				, n - 1	)







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				if index >= len(SCREAMING_SNAKE_CASE__	) or collection[index - 1] <= collection[index]:
								return

				# Swaps adjacent elements since they are not in ascending order
				_SCREAMING_SNAKE_CASE						,			_SCREAMING_SNAKE_CASE					:			List[Any]							= (
				    collection[index],
				    collection[index - 1],
				)

				insert_next(SCREAMING_SNAKE_CASE__				, index + 1	)


if __name__ == "__main__":
				UpperCAmelCase_						:  List[str]				  =						input('Enter integers separated by spaces: ')
				UpperCAmelCase_						:  list[int]				  =						[int(num) for num in numbers.split()]
				rec_insertion_sort(number_list, len(number_list))
				print(number_list)




