Go Solution using Prefix Sum and Binary Search
go\nfunc waysToSplit(nums []int) int {\n    n, mod := len(nums), 1000000007\n    for i := 1; i < n; i++ {\n        nums[i] += nums[i-1]\n    }\n    res := 0\n  
```go\nfunc waysToSplit(nums []int) int {\n    n, mod := len(nums), 1000000007\n    for i := 1; i < n; i++ {\n        nums[i] += nums[i-1]\n    }\n    res := 0\n    for i := 0; i < n - 2; i++ {\n        upper := searchUpper(nums, i, n - 1)\n        lower := searchLower(nums, i, upper)\n        if upper > lower {\n            res = (res + upper - lower) % mod\n        }\n    }\n    return res\n}\n\nfunc searchUpper(prefix []int, i int, j int) int {\n    l, r := i + 1, j\n    for l < r {\n        m := l + (r - l) / 2\n        mid := prefix[m] - prefix[i]\n        right := prefix[j] - prefix[m]\n        if mid <= right {\n            l = m + 1\n        } else {\n            r = m\n        }\n    }\n    return l\n}\n\nfunc searchLower(prefix []int, i int, j int) int {\n    l, r := i + 1, j\n    for l < r {\n        m := l + (r - l) / 2\n        mid := prefix[m] - prefix[i]\n        if mid < prefix[i] {\n            l = m + 1\n        } else {\n            r = m\n        }\n    }\n    return l\n}\n```
['Binary Tree', 'Prefix Sum', 'Go']