Simple java solution
Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n    public int maximumSumS
# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n    public int maximumSumSubsequence(int[] nums, int[][] queries) {\n        int n=nums.length;\n        long ans=0;\n        for(int i[]: queries)\n        {\n            int p=i[0];\n            int val=i[1];\n            nums[p]=val;\n            long sum=task(nums);\n            ans = (ans+sum)%1000000007;\n        }\n        return (int) ans;\n    }\n    private long task(int[] a)\n    {\n        long val1=0,val2=0;\n        for(int i: a)\n        {\n            long val=i+val2;\n            val2=Math.max(val1,val2);\n            val1=val;\n        }\n        return Math.max(val1,val2);\n    }\n}\n```
['Java']