





def 							_lowerCAmelCase (  _a   :					Optional[int]					,   _a   :					Dict					,   _a   :					int			)	->			float:
     lowerCAmelCase_					:       Union[str, Any]    =		(num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff)
     # formula for sum of series
     return total






def 							_lowerCAmelCase (  )	->			Any:
     print(sum_of_series(1					,   1					,   10			)			)


if __name__ == "__main__":
      import doctest

      doctest.testmod()












from collections.abc import Sequence






def 							_lowerCAmelCase (  _a   :					Sequence[float]					,   _a   :					bool = False			)	->			float:
     if not arr:
          return 0

     lowerCAmelCase_					:       List[str]    =		0 if allow_empty_subarrays else float("""-inf"""			)
     lowerCAmelCase_					:       List[Any]    =		0.0
     for num in arr:
          lowerCAmelCase_					:       int    =		max(0 if allow_empty_subarrays else num					,   curr_sum + num			)
          lowerCAmelCase_					:       List[str]    =		max(_a					,   _a			)

     return max_sum


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

      testmod()

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