






"""simple docstring"""
from __future__ import annotations

def 				snake_case      (   A__	,A__	,A__	,A__						):
			UpperCAmelCase_     : Tuple			     =					[]
			UpperCAmelCase_     ,	UpperCAmelCase_     : int			     =					input_list[low:mid], input_list[mid : high + 1]
			while left and right:
						result.append((left if left[0] <= right[0] else right).pop(0						)						)
			UpperCAmelCase_     : List[str]			     =					result + left + right
			return input_list

def 				snake_case      (   A__						):
			if len(A__						) <= 1:
						return input_list
			UpperCAmelCase_     : Tuple			     =					list(A__						)

			# iteration for two-way merging
			UpperCAmelCase_     : Union[str, Any]			     =					2
			while p <= len(A__						):
						# getting low, high and middle value for merge-sort of single list
						for i in range(0	,len(A__						)	,A__						):
									UpperCAmelCase_     : List[str]			     =					i
									UpperCAmelCase_     : Union[str, Any]			     =					i + p - 1
									UpperCAmelCase_     : Optional[int]			     =					(low + high + 1) // 2
									UpperCAmelCase_     : List[str]			     =					merge(A__	,A__	,A__	,A__						)
						# final merge of last two parts
						if p * 2 >= len(A__						):
									UpperCAmelCase_     : Dict			     =					i
									UpperCAmelCase_     : Tuple			     =					merge(A__	,0	,A__	,len(A__						) - 1						)
									break
						p *= 2

			return input_list


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











"""simple docstring"""
def 				snake_case      (   A__	,A__	,A__	,A__	,A__						):
			if index == number_of_items:
						return 0
			UpperCAmelCase_     : str			     =					0
			UpperCAmelCase_     : Dict			     =					0
			UpperCAmelCase_     : Tuple			     =					knapsack(A__	,A__	,A__	,A__	,index + 1						)
			if weights[index] <= max_weight:
						UpperCAmelCase_     : Union[str, Any]			     =					values[index] + knapsack(
						    A__	,A__	,A__	,max_weight - weights[index]	,index + 1						)
			return max(A__	,A__						)


if __name__ == "__main__":
			import doctest

			doctest.testmod()



