Easy to understand JS Solution ( Time and space complexity - O(N) | O(1)) 
Complexity
Time complexity: O(n)

Space complexity: O(1)
Code

# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(1)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
/**
 * @param {number[]} nums
 * @return {number}
 */
var waysToSplit = function(nums) {
    let modulee = 10 ** 9 + 7;
    let n = nums.length;
    let maxMiddleIndex = n -2;
    let totalSum = nums.reduce((acc, num) => acc + num, 0);
    let leftSum = 0;
    let middleStartSum = 0;
    let middleEndSum = 0;
    let count = 0;
    let middleStartIndex = -1;
    let middleEndIndex = -1;

    for(let i = 0; i < n; i++){
        leftSum += nums[i];
        middleStartSum -= nums[i];
        middleEndSum -= nums[i];

        while(middleStartIndex <= maxMiddleIndex && (middleStartIndex <= i || middleStartSum < leftSum)){
            middleStartIndex++;
            middleStartSum += nums[middleStartIndex];
        }

        while(middleEndIndex <= maxMiddleIndex && (middleStartIndex > middleEndIndex || middleEndSum <= totalSum - middleEndSum - leftSum)){
            middleEndIndex++;
            middleEndSum += nums[middleEndIndex];
        }

        count = (count + middleEndIndex - middleStartIndex) % modulee;
    }

    return count;

};
```
['JavaScript']