C++
\nclass Solution {\n    typedef long long ll;\npublic:\n    int sumOfFlooredPairs(vector<int>& nums) {\n        const int len = 100002;\n        ll eg[len] = {}
```\nclass Solution {\n    typedef long long ll;\npublic:\n    int sumOfFlooredPairs(vector<int>& nums) {\n        const int len = 100002;\n        ll eg[len] = {}; // eg[i] means # of elements equal or greater than i.\n        int cnt[len] = {}; // cnt[i] means of elements equal to i.\n        int maxnum = 0;\n        for(const auto& a : nums) {\n            cnt[a]++;\n            maxnum = max(maxnum, a);\n        }\n        \n        for(int i=maxnum; i>0; --i) {\n            eg[i] += eg[i+1];\n            if(cnt[i] > 0) eg[i] += cnt[i];   \n        }\n        \n        ll ans = 0;\n        for(int n=maxnum; n>0; n--) {\n            if(cnt[n] > 0) {\n                for(int f = maxnum / n; f > 0; f--) {\n                    // Find the # of elements that is >= f * n && < (f + 1) * n. Note that (f + 1) * n may overflow.  \n                    ans += f * (eg[f * n] - eg[min((f+1) * n, maxnum+1)]) * cnt[n];\n                }\n            }\n        }\n        \n        ll big = 1e9 + 7;\n        return ans % big;\n    }\n};\n```
[]