You are given an integer array nums.
For each index i, consider every earlier index j with j < i and nums[j] < nums[i], and add nums[j] to a running total.
Return the total modulo 10 ** 9 + 7.
Input: nums = [1,5,3,6,4]
Output: 15
Explanation: Index 1 (value 5) adds nums[0] = 1. Index 2 (value 3) adds nums[0] = 1. Index 3 (value 6) adds nums[0] + nums[1] + nums[2] = 1 + 5 + 3 = 9. Index 4 (value 4) adds nums[0] + nums[2] = 1 + 3 = 4. The total is 1 + 1 + 9 + 4 = 15.
Input: nums = [5,4,3,2,1]
Output: 0
Explanation: Every later value is smaller than every earlier value, so no index ever finds an earlier value that is strictly smaller than itself.
Input: nums = [2,2,3]
Output: 4
Explanation: Index 1 (value 2) finds no earlier value strictly smaller than 2. Index 2 (value 3) adds both earlier 2s: 2 + 2 = 4.
nums.length ≤105nums[i] ≤109