Typescript
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```typescript []\nfunction sumOfFlooredPairs(nums: number[]): number {\n    const MOD = 10**9 + 7;\n    const maxNum = Math.max(...nums);  \n\n    const freq = new Array(maxNum + 1).fill(0);\n    for (const num of nums) {\n        freq[num] += 1;\n    }\n\n    const prefixSum = new Array(maxNum + 1).fill(0);\n    for (let i = 1; i <= maxNum; i++) {\n        prefixSum[i] = prefixSum[i - 1] + freq[i];\n    }\n\n    let result = 0;\n    for (let num = 1; num <= maxNum; num++) {\n        if (freq[num] > 0) {\n            for (let multiple = 1; multiple * num <= maxNum; multiple++) {\n                const left = num * multiple;\n                const right = Math.min(num * (multiple + 1) - 1, maxNum);\n                const countInRange = prefixSum[right] - prefixSum[left - 1];\n                result = (result + freq[num] * countInRange * multiple) % MOD;\n            }\n        }\n    }\n\n    return result;\n}\n\n```
['TypeScript']