


from __future__ import annotations





def 							_UpperCAmelCase    (UpperCamelCase__					:  str    ,							UpperCamelCase__					:  List[str]						):
       _A				:	int       =			0
       _A				:	Any       =			len(UpperCamelCase__						) - 1
       while left <= right:
              _A				:	List[Any]       =			(left + right) // 2
              if left == right:
                     if sorted_list[middle] < item:
                            _A				:	Tuple       =			middle + 1
                     break
              elif sorted_list[middle] < item:
                     _A				:	Tuple       =			middle + 1
              else:
                     _A				:	Union[str, Any]       =			middle - 1
       sorted_list.insert(UpperCamelCase__    ,							UpperCamelCase__						)
       return sorted_list





def 							_UpperCAmelCase    (UpperCamelCase__					:  Optional[Any]    ,							UpperCamelCase__					:  Any						):
       _A				:	Optional[Any]       =			[]
       while left and right:
              if left[0][0] < right[0][0]:
                     result.append(left.pop(0						)						)
              else:
                     result.append(right.pop(0						)						)
       return result + left + right





def 							_UpperCAmelCase    (UpperCamelCase__					:  Union[str, Any]						):
       _A				:	List[str]       =			len(UpperCamelCase__						)
       if length <= 1:
              return list_ad
       _A				:	Any       =			length // 2
       return merge(sortlist_ad(list_ad[:middle]						)    ,							sortlist_ad(list_ad[middle:]						)						)





def 							_UpperCAmelCase    (UpperCamelCase__					:  list[int]						):

       if len(UpperCamelCase__						) <= 1:
              return collection
       _A				:	Union[str, Any]       =			[]
       _A				:	List[str]       =			False
       for i in range(0    ,							len(UpperCamelCase__						)    ,							2						):
              if i == len(UpperCamelCase__						) - 1:
                     _A				:	Union[str, Any]       =			True
              else:
                     if collection[i] < collection[i + 1]:
                            two_paired_list.append([collection[i], collection[i + 1]]						)
                     else:
                            two_paired_list.append([collection[i + 1], collection[i]]						)
       _A				:	Optional[Any]       =			sortlist_ad(UpperCamelCase__						)
       _A				:	Dict       =			[i[0] for i in sorted_list_ad]
       result.append(sorted_list_ad[-1][1]						)
       if has_last_odd_item:
              _A				:	int       =			collection[-1]
              _A				:	int       =			binary_search_insertion(UpperCamelCase__    ,							UpperCamelCase__						)
       _A				:	List[str]       =			False
       for i in range(len(UpperCamelCase__						) - 1						):
              if result[i] == collection[-1] and has_last_odd_item:
                     _A				:	Any       =			True
              _A				:	Union[str, Any]       =			sorted_list_ad[i][1]
              # If last_odd_item is inserted before the item's index,
              # you should forward index one more.
              if is_last_odd_item_inserted_before_this_index:
                     _A				:	List[str]       =			result[: i + 2] + binary_search_insertion(result[i + 2 :]    ,							UpperCamelCase__						)
              else:
                     _A				:	str       =			result[: i + 1] + binary_search_insertion(result[i + 1 :]    ,							UpperCamelCase__						)

       return result


if __name__ == "__main__":
    lowerCAmelCase__						=			input('Enter numbers separated by a comma:\n').strip()
    lowerCAmelCase__						=			[int(item) for item in user_input.split(',')]
    print(merge_insertion_sort(unsorted))




def 							_UpperCAmelCase    (UpperCamelCase__					:  str						):
       _A				:	Tuple       =			str(UpperCamelCase__						).strip()
       if not bin_string:
              raise ValueError("Empty string was passed to the function"						)
       _A				:	Dict       =			bin_string[0] == "-"
       if is_negative:
              _A				:	Any       =			bin_string[1:]
       if not all(char in "01" for char in bin_string						):
              raise ValueError("Non-binary value was passed to the function"						)
       _A				:	Union[str, Any]       =			0
       for char in bin_string:
              _A				:	Union[str, Any]       =			2 * decimal_number + int(UpperCamelCase__						)
       return -decimal_number if is_negative else decimal_number


if __name__ == "__main__":
    from doctest import testmod

    testmod()
