

"""simple docstring"""






from collections.abc import Sequence

def 		lowerCamelCase__		(       _lowerCamelCase = None ):

    '''simple docstring'''



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

    _lowerCAmelCase							: str	=     nums[0]
    for i in range(1			, len(_lowerCamelCase ) ):
        _lowerCAmelCase							: Dict	=     nums[i]
        _lowerCAmelCase							: Optional[int]	=     max(_lowerCamelCase			, ans + num			, _lowerCamelCase )

    return ans


if __name__ == "__main__":
 import doctest

 doctest.testmod()

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







from __future__ import annotations


def 				__A(lowerCAmelCase    ,	lowerCAmelCase			)		->					list[list[int]]:

		"""simple docstring"""






		_UpperCamelCase         =						[]
		_UpperCamelCase         =						[]
		_UpperCamelCase         =						0
		_UpperCamelCase         =						sum(lowerCAmelCase			)
		create_state_space_tree(lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase			)
		return result


def 				__A(lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	lowerCAmelCase    ,	)		->					None:

		"""simple docstring"""






		if sum(lowerCAmelCase			) > max_sum or (remaining_nums_sum + sum(lowerCAmelCase			)) < max_sum:
				return
		if sum(lowerCAmelCase			) == max_sum:
				result.append(lowerCAmelCase			)
				return
		for index in range(lowerCAmelCase    ,	len(lowerCAmelCase			)			):
				create_state_space_tree(
				    lowerCAmelCase    ,	lowerCAmelCase    ,	index + 1    ,	[*path, nums[index]]    ,	lowerCAmelCase    ,	remaining_nums_sum - nums[index]    ,	)
lowerCamelCase__						=				[3, 34, 4, 12, 5, 2]
lowerCamelCase__						=				9
lowerCamelCase__						=				generate_sum_of_subsets_soln(nums, max_sum)







print(*result)



