------
## 最终结论
```python
def maxSum(nums1, nums2):
    MOD = 10**9 + 7
    i, j = 0, 0
    m, n = len(nums1), len(nums2)
    sum1, sum2 = 0, 0

    while i < m and j < n:
        if nums1[i] < nums2[j]:
            sum1 += nums1[i]
            i += 1
        elif nums1[i] > nums2[j]:
            sum2 += nums2[j]
            j += 1
        else: 
            sum1 = max(sum1, sum2) + nums1[i]
            sum2 = sum1
            i += 1
            j += 1

    while i < m:
        sum1 += nums1[i]
        i += 1

    while j < n:
        sum2 += nums2[j]
        j += 1

    return max(sum1, sum2) % MOD

# Example usage:
nums1_1 = [2,4,5,8,10]
nums2_1 = [4,6,8,9]
print(maxSum(nums1_1, nums2_1)) # Output: 30

nums1_2 = [1,3,5,7,9]
nums2_2 = [3,5,100]
print(maxSum(nums1_2, nums2_2)) # Output: 109

nums1_3 = [1,2,3,4,5]
nums2_3 = [6,7,8,9,10]
print(maxSum(nums1_3, nums2_3)) # Output: 40

nums1_4 = [1,4,5,8,9,11,19]
nums2_4 = [2,3,4,11,12]
print(maxSum(nums1_4 ,nums2_4)) # Output: 61
```