[Go] 3 pointers - O(n)
go\ntype ll uint64\nconst MOD ll = 1e9 + 7\n\nfunc waysToSplit(nums []int) int {\n    var ans, cur, sum, leftSum, midSum ll = 0, 0, 0, ll(nums[0]), ll(nums[0])\
```go\ntype ll uint64\nconst MOD ll = 1e9 + 7\n\nfunc waysToSplit(nums []int) int {\n    var ans, cur, sum, leftSum, midSum ll = 0, 0, 0, ll(nums[0]), ll(nums[0])\n    n, lo, hi := len(nums), 1, 1\n    \n    for _, num := range nums {\n        sum += ll(num)\n    }\n    \n    for i := 0; i < n; i++ {\n        cur += ll(nums[i])\n        \n        // right is the right sumarray\n        right := sum - cur\n        \n        if i == 0 || i == n - 1 {\n            continue\n        }\n        \n        // calculate the right boundry of the middle array by increasing midSum till it is as twice as big as left (cur - midSum)\n        for hi <= i && cur >= 2 * midSum {\n            midSum += ll(nums[hi])\n            hi++\n        }\n        \n        // calculate the left boundry of th middle array while midSum ramains <= right\n        for lo < hi && cur - leftSum > right {\n            leftSum += ll(nums[lo])\n            lo++\n        }\n        \n        if lo < hi {\n            ans += ll(hi - lo)\n            ans %= MOD\n        }\n    }\n    \n    return int(ans)\n}\n```
['Go']