C++
```cpp []
class Solution {
public:
    int s = 100001, MOD = 1e9 + 7;
    int p[100001] = {};

    int sumOfFlooredPairs(vector<int>& nums) {
        for (auto& n : nums) ++p[n];
        for (int i = 1; i < s; ++i)
            p[i] += p[i - 1];

        long long ans = 0;
        for (int i = 1; i < s; ++i) {
            int freq = p[i] - p[i - 1];
            if (freq > 0) {
                for (int f = 1; f * f <= i; ++f) {
                    int rf = i / f;
                    int right = i / f;
                    int left = i / (f + 1);
                    long long add1 = 1LL * freq * (p[right] - p[left]) % MOD * f % MOD;
                    ans = (ans + add1) % MOD;

                    if (rf != f) {
                        int left2 = i / (rf + 1);
                        int right2 = i / rf;
                        long long add2 = 1LL * freq * (p[right2] - p[left2]) % MOD * rf % MOD;
                        ans = (ans + add2) % MOD;
                    }
                }
            }
        }
        return ans;
    }
};

```
['C++']