



'''simple docstring'''
from collections.abc import Sequence






def A__   (					UpperCAmelCase_ = None							):
						if nums is None or not nums:
												raise ValueError('Input sequence should not be empty'							)

						_UpperCamelCase :		Union[str, Any]			    =       nums[0]
						for i in range(1  ,  len(UpperCAmelCase_							)							):
												_UpperCamelCase :		List[Any]			    =       nums[i]
												_UpperCamelCase :		List[Any]			    =       max(UpperCAmelCase_  ,  ans + num  ,  UpperCAmelCase_							)

						return ans


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					# Try on a sample input from the user
					snake_case_			:     Optional[int]  	=  int(input('Enter number of elements : ').strip())
					snake_case_			:     Dict  	=  list(map(int, input('\nEnter the numbers : ').strip().split()))[:n]
					print(max_subsequence_sum(array))







'''simple docstring'''
from __future__ import annotations






def A__   (					UpperCAmelCase_							):
						if not nums:
												return 0
						_UpperCamelCase :		Any			    =       nums[0]
						_UpperCamelCase :		Optional[int]			    =       0
						for num in nums[1:]:
												_UpperCamelCase    ,      _UpperCamelCase :		Optional[Any]			    =       (
												    max_excluding + num,
												    max(UpperCAmelCase_  ,  UpperCAmelCase_							),
												)
						return max(UpperCAmelCase_  ,  UpperCAmelCase_							)


if __name__ == "__main__":
					import doctest

					doctest.testmod()


