





'''simple docstring'''




from collections.abc import Sequence
def 	UpperCAmelCase_							(					__lowercase							:      List[Any] = None       )		->       int:


     '''simple docstring'''



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

     _UpperCAmelCase     							=   nums[0]
     for i in range(1			,     len(_SCREAMING_SNAKE_CASE       )       ):
          _UpperCAmelCase     							=   nums[i]
          _UpperCAmelCase     							=   max(_SCREAMING_SNAKE_CASE			,     ans + num			,     _SCREAMING_SNAKE_CASE       )

     return ans


if __name__ == "__main__":
  import doctest

  doctest.testmod()

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





"""simple docstring"""
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->int:
  while a != 0:
    a__							,    a__:     List[str]										=	b % a, a
  return b







def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->int:
  if gcd(_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   ) != 1:
    a__:     Dict										=	F'mod inverse of {a!r} and {m!r} does not exist'
    raise ValueError(_SCREAMING_SNAKE_CASE   )
  a__							,    a__							,    a__:     Union[str, Any]										=	1, 0, a
  a__							,    a__							,    a__:     Any										=	0, 1, m
  while va != 0:
    a__:     int										=	ua // va
    a__							,    a__							,    a__							,    a__							,    a__							,    a__:     Any										=	(ua - q * va), (ua - q * va), (ua - q * va), va, va, va
  return ua % m


