input: from typing import List
  
  def maximize_subarray_total(nums: List[int]) -> int:
      """
      Given an integer array `nums` of length n, you are required to find the maximal total cost of its subarrays.
  
      The cost of the subarray `nums[l..r]`, where 0 <= l <= r < n, is defined by:
      cost(l, r) = nums[l] - nums[l + 1] + ... + nums[r] * (−1)^(r − l)
  
      The task is to split `nums` into multiple subarrays to maximize the combined cost, ensuring each element belongs to exactly one subarray.
  
      Formally, if `nums` is divided into `k` subarrays, where `k > 1`, at indices i_1, i_2, ..., i_k−1, where 0 <= i_1 < i_2 < ... < i_k - 1 < n - 1, then the total cost is:
      cost(0, i_1) + cost(i_1 + 1, i_2) + ... + cost(i_k−1 + 1, n−1)
  
      Return an integer representing the maximum possible total cost after optimally splitting the array.
  
      Note:
      If `nums` is treated as a single subarray (k = 1), the total cost equals cost(0, n - 1).
  
      Examples:
      >>> nums = [1, -2, 3, 4]
      10
      >>> nums = [1, -1, 1, -1]
      4
  
      Constraints:
      1 <= len(nums) <= 10^5
      -10^9 <= nums[i] <= 10^9
      """
output:     n = len(nums)
      if n == 1:
          return nums[0]
  
      max_cost = 0
      for i in range(n):
          if nums[i] > 0:
              max_cost += nums[i]
  
      return max_cost