


from collections.abc import Sequence




def     UpperCamelCase    (      _a = None		)					->							int:
     '''simple docstring'''





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

     lowercase_       :Optional[int]     =       nums[0]
     for i in range(1       ,		len(SCREAMING_SNAKE_CASE_		)		):
          lowercase_       :Optional[int]     =       nums[i]
          lowercase_       :Optional[int]     =       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       :		List[str]         =  int(input("Enter number of elements : ").strip())
   SCREAMING_SNAKE_CASE       :		Tuple         =  list(map(int, input("\nEnter the numbers : ").strip().split()))[:n]
   print(max_subsequence_sum(array))





def     UpperCamelCase    (      _a       ,		_a		)					->							int:
     '''simple docstring'''





     while a != 0:
          lowercase_    ,      lowercase_       :Union[str, Any]     =       b % a, a
     return b




def     UpperCamelCase    (      _a       ,		_a		)					->							int:
     '''simple docstring'''





     if gcd(_a       ,		_a		) != 1:
          lowercase_       :Union[str, Any]     =       f"mod inverse of {a!r} and {m!r} does not exist"
          raise ValueError(_a		)
     lowercase_    ,      lowercase_    ,      lowercase_       :Any     =       1, 0, a
     lowercase_    ,      lowercase_    ,      lowercase_       :List[str]     =       0, 1, m
     while va != 0:
          lowercase_       :Tuple     =       ua // va
          lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_    ,      lowercase_       :Optional[int]     =       (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
     return ua % m

