Sponsored
Use these hints if you're stuck. Try solving on your own first.
Compute all sums and save it in array.
Then just go from LEFT to RIGHT index and calculate answer modulo 1e9 + 7.
Solve with full IDE support and test cases