C++ Easy Solution
\nclass Solution {\npublic:\n    int sumDistance(vector<int>& nums, string s, int d) {\n        vector<int>position(nums.size());\n        int m =1e9+7;\n      
```\nclass Solution {\npublic:\n    int sumDistance(vector<int>& nums, string s, int d) {\n        vector<int>position(nums.size());\n        int m =1e9+7;\n        for(int i=0;i<nums.size();i++){\n            if(s[i]==\'R\'){\n                position[i]=d+nums[i];\n            }\n            else{\n                position[i]=nums[i]-d;\n            }\n        }\n        sort(position.begin(),position.end());\n        vector<long long>sum(nums.size());\n        sum[nums.size()-1]=position[nums.size()-1];\n        for(int i=position.size()-2;i>=0;i--){\n            sum[i]=(position[i]+sum[i+1]);\n            sum[i]%=m;\n        }\n        long long ans= 0;\n        for(int i=0;i<position.size()-1;i++){\n            long long ww = (position[i]*(position.size()-i-1));\n            ww=ww;\n            ww-=sum[i+1];\n            ans=(ans+ww);\n        }\n        return abs(ans)%m;\n    }\n};\n```
[]