Python | Binary Search with bisect_right After Sorting | O(nlogn) | Clean Code
```\nfrom bisect import bisect_right\n\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        M = 109 + 7\n        nums.sort()\n   
```\nfrom bisect import bisect_right\n\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        M = 10**9 + 7\n        nums.sort()\n        i = 0\n        n = len(nums)\n        res = 0\n        while i < n:\n            cur = nums[i]\n            l = bisect_right(nums, cur)\n            #number of cur element\n            curn = (l-i)\n            res += curn**2\n            i = l\n            while l < n:\n                q = nums[l]//cur\n                r = bisect_right(nums, cur*q+cur-1)\n                res = (res+curn*q*(r-l))%M\n                l = r\n        return res
['Binary Search', 'Python']