def 	__lowerCamelCase							(UpperCAmelCase__     :							Optional[int]  ):
					SCREAMING_SNAKE_CASE			,   SCREAMING_SNAKE_CASE    			=       [], []
					while len(UpperCAmelCase__  ) > 1:
										SCREAMING_SNAKE_CASE			,   SCREAMING_SNAKE_CASE    			=       min(UpperCAmelCase__  ), max(UpperCAmelCase__  )
										start.append(UpperCAmelCase__  )
										end.append(UpperCAmelCase__  )
										collection.remove(UpperCAmelCase__  )
										collection.remove(UpperCAmelCase__  )
					end.reverse()
					return start + collection + end


if __name__ == "__main__":
							_lowerCamelCase					:   str							=		input('''Enter numbers separated by a comma:\n''').strip()
							_lowerCamelCase					:   List[str]							=		[int(item) for item in user_input.split(''',''')]
							print(*merge_sort(unsorted), sep=''',''')





import functools





def 	__lowerCamelCase							(UpperCAmelCase__     :							list[int]      , UpperCAmelCase__     :							list[int]  ):

					# Validation
					if not isinstance(UpperCAmelCase__      , UpperCAmelCase__  ) or not all(isinstance(UpperCAmelCase__      , UpperCAmelCase__  ) for day in days  ):
										raise ValueError("The parameter days should be a list of integers"  )

					if len(UpperCAmelCase__  ) != 3 or not all(isinstance(UpperCAmelCase__      , UpperCAmelCase__  ) for cost in costs  ):
										raise ValueError("The parameter costs should be a list of three integers"  )

					if len(UpperCAmelCase__  ) == 0:
										return 0

					if min(UpperCAmelCase__  ) <= 0:
										raise ValueError("All days elements should be greater than 0"  )

					if max(UpperCAmelCase__  ) >= 3_6_6:
										raise ValueError("All days elements should be less than 366"  )

					SCREAMING_SNAKE_CASE    			=       set(UpperCAmelCase__  )

					@functools.cache
					def dynamic_programming(UpperCAmelCase__     :							int  ) -> int:
										if index > 3_6_5:
															return 0

										if index not in days_set:
															return dynamic_programming(index + 1  )

										return min(
										    costs[0] + dynamic_programming(index + 1  )      , costs[1] + dynamic_programming(index + 7  )      , costs[2] + dynamic_programming(index + 3_0  )      , )

					return dynamic_programming(1  )


if __name__ == "__main__":
							import doctest

							doctest.testmod()




