input: from typing import List
  
  def max_sum_non_adjacent_subsequence(arr: List[int], modifications: List[List[int]]) -> int:
      """
      Given an integer array arr and a 2D array modifications, where modifications[i] = [index_i, value_i].
  
      For each modification i, set arr[index_i] to value_i, then compute the maximum sum of a subsequence
      of arr such that no two adjacent elements are included.
  
      Return the total sum of the results for all modifications.
  
      Because the final result may be very large, return it modulo 10^9 + 7.
  
      A subsequence is derived from another array by deleting some or no elements without altering the order of the remaining elements.
  
      Examples:
      >>> arr = [3,5,9], modifications = [[1,-2],[0,-3]]
      21
      >>> arr = [0,-1], modifications = [[0,-5]]
      0
  
      Constraints:
      1 <= arr.length <= 5 * 10^4
      -10^5 <= arr[i] <= 10^5
      1 <= modifications.length <= 5 * 10^4
      modifications[i] == [index_i, value_i]
      0 <= index_i <= arr.length - 1
      -10^5 <= value_i <= 10^5
      """
output:     
      MOD = 10**9 + 7
  
      def max_sum_non_adjacent(arr: List[int]) -> int:
          # Helper function to find maximum sum of non-adjacent subsequence
          incl = 0  # max sum including the previous element
          excl = 0  # max sum excluding the previous element
          
          for num in arr:
              # Current max sum excluding the current element
              new_excl = max(incl, excl)
              # Current max sum including the current element
              incl = excl + num
              excl = new_excl
              
          return max(incl, excl) % MOD
  
      total_sum = 0
  
      for index, value in modifications:
          # Apply the modification
          arr[index] = value
          # Calculate the max sum of non-adjacent subsequence
          total_sum += max_sum_non_adjacent(arr)
          total_sum %= MOD
  
      return total_sum
  