Beats the new test cases!!
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int sumDistance(vector<int>& num, string s, int d) {\n        vector<long long> nums(num.begin(),num.end());\n        int i = 0, n = nums.size();\n        for(i = 0; i < n; i++){\n            if(s[i]==\'R\'){\n                nums[i] += d;\n            }else{\n                nums[i] -= d;\n            }\n        }\n        sort(nums.begin(),nums.end());\n        long long ans = 0,mod = 1e9+7,p = 0;\n        for(i = 0; i < n; i++){\n            ans = (((ans+(nums[i]*1LL*i)%mod)%mod-p)%mod+mod)%mod;\n            p = (p+nums[i])%mod;\n        }\n        return (ans+mod)%mod;\n    }\n};\n```
['C++']