C++ || UNIQUE || COUNT REPETITION OF EDGES
Intuition\nSo firstly I will talk about finding the point at which the robots will be after d second so for that don\'t confuse with collision part just add or 
# Intuition\nSo firstly I will talk about finding the point at which the robots will be after d second so for that don\'t confuse with collision part just add or subtract d based on \'L\' and \'R\' because the position only matter for calculating all pairs distances. And after that just calculate distance.\n\n\n# Complexity\n- Time complexity:O(nlog(n))\n\n- Space complexity:O(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int sumDistance(vector<int>& nums, string s, int d) {\n\n        long long int n = nums.size();\n        vector<long long int>num(n,0);\n        long long int mod = 1e9 + 7;\n\n        // preapare new array with stores final positions\n        for(long long int i = 0;i<n;i++){\n            if(s[i] == \'R\'){\n                num[i] = nums[i] + d;\n            }\n            else{\n                num[i] = nums[i] - d;\n            }\n        }\n\n        // sorting array as on increasing order on x-axis\n        sort(num.begin() , num.end());\n\n        // implemented Algorithm \n        int ans = 0;\n        long long int rockets = 0;\n        for(long long int i = 1;i<n;i++){\n            rockets += (n-i + mod);\n            rockets %= mod;\n            ans = (ans + ((num[i] - num[i-1])*rockets) )%mod;\n            rockets -= i;\n        }\n        return ans%mod;\n    }\n};\n```
['C++']