MOD SUCKS
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```cpp []\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    int maxSum(vector<int>& nums1, vector<int>& nums2) {\n        long long int i = 0, j = 0, sum1=0, sum2 = 0, ans = 0;\n        while(i < nums1.size() && j<nums2.size()){\n            if(nums1[i] < nums2[j]){\n                sum1 += nums1[i++];\n            }else if(nums1[i]> nums2[j]){\n                sum2 += nums2[j++];\n            }else{\n                ans += (max(sum1, sum2));\n                ans += nums1[i];\n                sum1 = 0; sum2 = 0;\n                i++;\n                j++;\n            }\n        }\n        while(i<nums1.size()){\n            sum1 += nums1[i++];\n        }\n        while(j<nums2.size()){\n            sum2 += nums2[j++];\n        }\n        return (ans + max(sum1,sum2))%mod;\n    }\n};\n```
['C++']