<p>You are given a binary array <code>nums</code>.</p>

<p>A subarray of an array is <strong>good</strong> if it contains <strong>exactly</strong> <strong>one</strong> element with the value <code>1</code>.</p>

<p>Return <em>an integer denoting the number of ways to split the array </em><code>nums</code><em> into <strong>good</strong> subarrays</em>. As the number may be too large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>

<p>A subarray is a contiguous <strong>non-empty</strong> sequence of elements within an array.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> nums = [0,1,0,0,1]
<strong>Output:</strong> 3
<strong>Explanation:</strong> There are 3 ways to split nums into good subarrays:
- [0,1] [0,0,1]
- [0,1,0] [0,1]
- [0,1,0,0] [1]
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> nums = [0,1,0]
<strong>Output:</strong> 1
<strong>Explanation:</strong> There is 1 way to split nums into good subarrays:
- [0,1,0]
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
	<li><code>0 &lt;= nums[i] &lt;= 1</code></li>
</ul>

class Solution:
    def numberOfGoodSubarraySplits(self, nums: List[int]) -> int:
        # If the sum of the elements of nums equals 0, return 0 because there are no 1s in nums and no good subarrays can be formed.
        if sum(nums) == 0:
            return 0
        # Create an integer variable, result, to store the number of ways to split nums into good subarrays, initialized to 1. Create an integer variable, count, to count the number of 0s between consecutive 1s, initialized to 1.
        result = 1
        count = 1
        # Iterate through the indices of the elements of nums using i.
        for i in range(len(nums)):
            # If nums[i] is equal to 1, enter another for loop.
            if nums[i] == 1:
                # Iterate over the indices of the elements of nums in the range [i, len(nums) - 1] using j.
                for j in range(i, len(nums)):
                    # If nums[j] is equal to 1, result is multiplied by count (the number of 0s plus one since count starts at 1) and then taken modulo 10 ** 9 + 7 to keep the number manageable. After this, reset count to 1.
                    if nums[j] == 1:
                        result = result * count % (10 ** 9 + 7)
                        count = 1
                    # If nums[j] is equal to 0, increment count by 1 to count the number of 0s between 1s.
                    if nums[j] == 0:
                        count += 1
                # After exiting the inner for loop, break to break out of the inner loop once a 1 has been processed to avoid counting the same 1 multiple times.
                break
        # After exiting the outer for loop, return result.
        return result
1741