Python Simple
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```python3 []\nclass Solution:\n    def sumDistance(self, nums: List[int], s: str, d: int) -> int:\n        arr = [0]*(len(nums))\n        res = 0\n        for i in range(0,len(nums)):\n            if s[i] == "L":\n                arr[i] = nums[i]+d*-1\n            else:\n                arr[i] = nums[i]+d\n        prefix = [0]*(len(nums)+1)\n        arr.sort()\n        for i in range(1,len(nums)+1):\n            prefix[i] = prefix[i-1] + arr[i-1]\n        for i in range(0,len(nums)):\n            res = (res+arr[i]*i-prefix[i]) % (10**9 + 7)\n\n        return res\n        \n        \n```
['Python3']