






from math import factorial





class 					A__     :

     '''simple docstring'''






     def __init__( self      :    Union[str, Any]   ,						_SCREAMING_SNAKE_CASE      :    int   ,						_SCREAMING_SNAKE_CASE      :    int ):






           """simple docstring"""




           UpperCamelCase					       =  real
           if isinstance(_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE ):
                 UpperCamelCase					       =  [1] * rank
           else:
                 UpperCamelCase					       =  rank







     def __repr__( self      :    Optional[Any] ):






           """simple docstring"""




           return (
               f'{self.real}+'
               f'{"+".join(str(_SCREAMING_SNAKE_CASE )+"E"+str(n+1 )for n,dual in enumerate(self.duals ) )}'
           )







     def   _SCREAMING_SNAKE_CASE     ( self      :    Optional[Any] ):






           """simple docstring"""




           UpperCamelCase					       =  self.duals.copy()
           while cur[-1] == 0:
                 cur.pop(-1 )
           return Dual(self.real   ,						_SCREAMING_SNAKE_CASE )







     def __add__( self      :    Union[str, Any]   ,						_SCREAMING_SNAKE_CASE      :    Dict ):






           """simple docstring"""




           if not isinstance(_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE ):
                 return Dual(self.real + other   ,						self.duals )
           UpperCamelCase					       =  self.duals.copy()
           UpperCamelCase					       =  other.duals.copy()
           if len(_SCREAMING_SNAKE_CASE ) > len(_SCREAMING_SNAKE_CASE ):
                 o_dual.extend([1] * (len(_SCREAMING_SNAKE_CASE ) - len(_SCREAMING_SNAKE_CASE )) )
           elif len(_SCREAMING_SNAKE_CASE ) < len(_SCREAMING_SNAKE_CASE ):
                 s_dual.extend([1] * (len(_SCREAMING_SNAKE_CASE ) - len(_SCREAMING_SNAKE_CASE )) )
           UpperCamelCase					       =  []
           for i in range(len(_SCREAMING_SNAKE_CASE ) ):
                 new_duals.append(s_dual[i] + o_dual[i] )
           return Dual(self.real + other.real   ,						_SCREAMING_SNAKE_CASE )

     snake_case__					=					__add__







     def __sub__( self      :    List[str]   ,						_SCREAMING_SNAKE_CASE      :    int ):






           """simple docstring"""




           return self + other * -1







     def __mul__( self      :    Dict   ,						_SCREAMING_SNAKE_CASE      :    Dict ):






           """simple docstring"""




           if not isinstance(_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE ):
                 UpperCamelCase					       =  []
                 for i in self.duals:
                       new_duals.append(i * other )
                 return Dual(self.real * other   ,						_SCREAMING_SNAKE_CASE )
           UpperCamelCase					       =  [0] * (len(self.duals ) + len(other.duals ) + 1)
           for i, item in enumerate(self.duals ):
                 for j, jtem in enumerate(other.duals ):
                       new_duals[i + j + 1] += item * jtem
           for k in range(len(self.duals ) ):
                 new_duals[k] += self.duals[k] * other.real
           for index in range(len(other.duals ) ):
                 new_duals[index] += other.duals[index] * self.real
           return Dual(self.real * other.real   ,						_SCREAMING_SNAKE_CASE )

     snake_case__					=					__mul__







     def __truediv__( self      :    str   ,						_SCREAMING_SNAKE_CASE      :    Optional[Any] ):






           """simple docstring"""




           if not isinstance(_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE ):
                 UpperCamelCase					       =  []
                 for i in self.duals:
                       new_duals.append(i / other )
                 return Dual(self.real / other   ,						_SCREAMING_SNAKE_CASE )
           raise ValueError







     def __floordiv__( self      :    Dict   ,						_SCREAMING_SNAKE_CASE      :    Optional[Any] ):






           """simple docstring"""




           if not isinstance(_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE ):
                 UpperCamelCase					       =  []
                 for i in self.duals:
                       new_duals.append(i // other )
                 return Dual(self.real // other   ,						_SCREAMING_SNAKE_CASE )
           raise ValueError







     def __pow__( self      :    int   ,						_SCREAMING_SNAKE_CASE      :    Tuple ):






           """simple docstring"""




           if n < 0 or isinstance(_SCREAMING_SNAKE_CASE   ,						_SCREAMING_SNAKE_CASE ):
                 raise ValueError('power must be a positive integer' )
           if n == 0:
                 return 1
           if n == 1:
                 return self
           UpperCamelCase					       =  self
           for _ in range(n - 1 ):
                 x *= self
           return x

def 		lowercase__  (				_UpperCamelCase       ,							_UpperCamelCase       ,							_UpperCamelCase) ->			Any:
      """simple docstring"""

      if not callable(_UpperCamelCase):
            raise ValueError('differentiate() requires a function as input for func')
      if not isinstance(_UpperCamelCase       ,							(float, int)):
            raise ValueError('differentiate() requires a float as input for position')
      if not isinstance(_UpperCamelCase       ,							_UpperCamelCase):
            raise ValueError('differentiate() requires an int as input for order')
      UpperCamelCase					       =  Dual(_UpperCamelCase       ,							1)
      UpperCamelCase					       =  func(_UpperCamelCase)
      if order == 0:
            return result.real
      return result.duals[order - 1] * factorial(_UpperCamelCase)


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       def 		lowercase__  (				_UpperCamelCase) ->			Optional[int]:
             """simple docstring"""

             return y**2 * y**4
       print(differentiate(f, 9, 2))











__magic_name__   :  Optional[Any]        =							0  # The first color of the flag.
__magic_name__   :  List[str]        =							1  # The second color of the flag.
__magic_name__   :  Dict        =							2  # The third color of the flag.
__magic_name__   :  Union[str, Any]        =							(red, white, blue)
def 		lowercase__  (				_UpperCamelCase) ->			list:
      """simple docstring"""

      if not sequence:
            return []
      if len(_UpperCamelCase) == 1:
            return list(_UpperCamelCase)
      UpperCamelCase					       =  0
      UpperCamelCase					       =  len(_UpperCamelCase) - 1
      UpperCamelCase					       =  0
      while mid <= high:
            if sequence[mid] == colors[0]:
                  UpperCamelCase       ,  UpperCamelCase					       =  sequence[mid], sequence[low]
                  low += 1
                  mid += 1
            elif sequence[mid] == colors[1]:
                  mid += 1
            elif sequence[mid] == colors[2]:
                  UpperCamelCase       ,  UpperCamelCase					       =  sequence[high], sequence[mid]
                  high -= 1
            else:
                  UpperCamelCase					       =  F'The elements inside the sequence must contains only {colors} values'
                  raise ValueError(_UpperCamelCase)
      return sequence


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       __magic_name__   :  str        =							input('''Enter numbers separated by commas:\n''').strip()
       __magic_name__   :  Union[str, Any]        =							[int(item.strip()) for item in user_input.split(''',''')]
       print(F'{dutch_national_flag_sort(unsorted)}')



