






from __future__ import annotations

def 			__lowerCamelCase     (						snake_case__			,snake_case__			,snake_case__			,snake_case__						)				->    int:






						"""simple docstring"""





						if counter == 0 or capacity == 0:
												return 0

						# If weight of the nth item is more than Knapsack of capacity,
						#   then this item cannot be included in the optimal solution,
						# else return the maximum of two cases:
						#   (1) nth item included
						#   (2) not included
						if weights[counter - 1] > capacity:
												return knapsack(snake_case__			,snake_case__			,snake_case__			,counter - 1						)
						else:
												_SCREAMING_SNAKE_CASE       =    capacity - weights[counter - 1]
												_SCREAMING_SNAKE_CASE       =    values[counter - 1] + knapsack(
												    snake_case__			,snake_case__			,snake_case__			,counter - 1						)
												_SCREAMING_SNAKE_CASE       =    knapsack(snake_case__			,snake_case__			,snake_case__			,counter - 1						)
												return max(snake_case__			,snake_case__						)


if __name__ == "__main__":
		import doctest

		doctest.testmod()









from __future__ import annotations

def 			__lowerCamelCase     (						snake_case__			,snake_case__						)				->    Dict:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE       =    0
						_SCREAMING_SNAKE_CASE       =    len(snake_case__						) - 1
						while left <= right:
												_SCREAMING_SNAKE_CASE       =    (left + right) // 2
												if left == right:
																		if sorted_list[middle] < item:
																								_SCREAMING_SNAKE_CASE       =    middle + 1
																		break
												elif sorted_list[middle] < item:
																		_SCREAMING_SNAKE_CASE       =    middle + 1
												else:
																		_SCREAMING_SNAKE_CASE       =    middle - 1
						sorted_list.insert(snake_case__			,snake_case__						)
						return sorted_list

def 			__lowerCamelCase     (						snake_case__			,snake_case__						)				->    Optional[Any]:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE       =    []
						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 			__lowerCamelCase     (						snake_case__						)				->    List[str]:






						"""simple docstring"""





						_SCREAMING_SNAKE_CASE       =    len(snake_case__						)
						if length <= 1:
												return list_ad
						_SCREAMING_SNAKE_CASE       =    length // 2
						return merge(sortlist_ad(list_ad[:middle]						)			,sortlist_ad(list_ad[middle:]						)						)

def 			__lowerCamelCase     (						snake_case__						)				->    list[int]:






						"""simple docstring"""





						if len(snake_case__						) <= 1:
												return collection
						_SCREAMING_SNAKE_CASE       =    []
						_SCREAMING_SNAKE_CASE       =    False
						for i in range(0			,len(snake_case__						)			,2						):
												if i == len(snake_case__						) - 1:
																		_SCREAMING_SNAKE_CASE       =    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]]						)
						_SCREAMING_SNAKE_CASE       =    sortlist_ad(snake_case__						)
						_SCREAMING_SNAKE_CASE       =    [i[0] for i in sorted_list_ad]
						result.append(sorted_list_ad[-1][1]						)
						if has_last_odd_item:
												_SCREAMING_SNAKE_CASE       =    collection[-1]
												_SCREAMING_SNAKE_CASE       =    binary_search_insertion(snake_case__			,snake_case__						)
						_SCREAMING_SNAKE_CASE       =    False
						for i in range(len(snake_case__						) - 1						):
												if result[i] == collection[-1] and has_last_odd_item:
																		_SCREAMING_SNAKE_CASE       =    True
												_SCREAMING_SNAKE_CASE       =    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:
																		_SCREAMING_SNAKE_CASE       =    result[: i + 2] + binary_search_insertion(result[i + 2 :]			,snake_case__						)
												else:
																		_SCREAMING_SNAKE_CASE       =    result[: i + 1] + binary_search_insertion(result[i + 1 :]			,snake_case__						)

						return result


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

