Python (Simple Two Pointers)
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 maxSum(self, nums1, nums2):\n        n, m, mod = len(nums1), len(nums2), 10**9+7 \n        i, j, total, sum_1, sum_2 = 0, 0, 0, 0, 0 \n\n        while i < n and j < m:\n            if nums1[i] == nums2[j]:\n                total += max(sum_1,sum_2) + nums1[i]\n                sum_1 = 0 \n                sum_2 = 0 \n                i += 1 \n                j += 1 \n            elif nums1[i] < nums2[j]:\n                sum_1 += nums1[i]\n                i += 1\n            else:\n                sum_2 += nums2[j] \n                j += 1 \n\n        while i < n:\n            sum_1 += nums1[i]\n            i += 1 \n\n        while j < m:\n            sum_2 += nums2[j]\n            j += 1 \n\n        total += max(sum_1,sum_2)\n\n        return total%mod \n```
['Python3']