




"""simple docstring"""




from collections.abc import Sequence



def     a__ (				snake_case__       , snake_case__ = False				)						->					int:
			if not arr:
						return 0

			lowerCamelCase			      =					0 if allow_empty_subarrays else float("""-inf"""				)
			lowerCamelCase			      =					0.0
			for num in arr:
						lowerCamelCase			      =					max(0 if allow_empty_subarrays else num       , curr_sum + num				)
						lowerCamelCase			      =					max(__snake_case       , __snake_case				)

			return max_sum


if __name__ == "__main__":
					from doctest import testmod

					testmod()

					lowerCAmelCase							:			List[Any]     							=							[-2, 1, -3, 4, -1, 2, 1, -5, 4]
					print(F"""{max_subarray_sum(nums) = }""")











"""simple docstring"""



def 						lowercase    (				__snake_case				: int = 1_0_0_0	):
		lowercase_       ,					lowercase_ : str							       =   1, 1
		lowercase_ : List[str]							       =   2
		while True:
				lowercase_ : Tuple							       =   0
				lowercase_ : List[Any]							       =   fa + fa
				lowercase_       ,					lowercase_ : Optional[int]							       =   fa, f
				index += 1
				for _ in str(__snake_case	):
						i += 1
				if i == n:
						break
		return index


if __name__ == "__main__":
						print(solution(int(str(input()).strip())))



