




from __future__ import annotations




def 		lowerCAmelCase_ (						lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase ):
				__magic_name__						:						str										=[]
				__magic_name__					,			__magic_name__						:						str										=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 ) )
				__magic_name__						:						int										=result + left + right
				return input_list




def 		lowerCAmelCase_ (						lowerCamelCase ):
				if len(lowerCamelCase ) <= 1:
								return input_list
				__magic_name__						:						Any										=list(lowerCamelCase )

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

				return input_list


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










from collections.abc import Sequence




def 		lowerCAmelCase_ (						lowerCamelCase = None ):
				if nums is None or not nums:
								raise ValueError("""Input sequence should not be empty""" )

				__magic_name__						:						str										=nums[0]
				for i in range(1						,  len(lowerCamelCase ) ):
								__magic_name__						:						Any										=nums[i]
								__magic_name__						:						Dict										=max(lowerCamelCase						,  ans + num						,  lowerCamelCase )

				return ans


if __name__ == "__main__":
							import doctest

							doctest.testmod()

							# Try on a sample input from the user
							UpperCAmelCase_		:					List[str]          =  int(input("Enter number of elements : ").strip())
							UpperCAmelCase_		:					Tuple          =  list(map(int, input("\nEnter the numbers : ").strip().split()))[:n]
							print(max_subsequence_sum(array))




