beats 100%
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```\nclass Solution {\n    private static final int MOD = 1000000007;\n    public int maximumSumSubsequence(int[] nums, int[][] queries) {\n        int n = nums.length;\n        long total = 0;\n\n        for (int[] query : queries) {\n            int pos = query[0];\n            int xi = query[1];\n            nums[pos] = xi;\n            total += maxsum(nums);\n            total %= MOD;\n        }\n\n        return (int) total;\n    }\n    private long maxsum(int[] nums) {\n        long in = 0; //include\n        long ex = 0;  //exclude\n\n        for (int num : nums) \n        {\n            long ele = Math.max(in, ex);\n            in = ex + num;\n            ex = ele;\n        }\n\n        return Math.max(in, ex);\n    }\n\n}\n```
['Java']