#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
#define all(x) (x).begin(),(x).end()
#define int long long int
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define F first
#define S second
#define inf 1e18
#define vi vector<int>
#define Point complex<int>
#define X real()
#define Y imag()
#define pii pair<int,int>
#define num0Beg(x) __builtin_clz(x) // no. of zero in beginning of bit representation
#define num0end(x) __builtin_ctz(x) // no. of zero in the end
#define numOf1(x) __builtin_popcount(x) // no. of ones in bit rep.
#define parity(x) __builtin_parity(x) // parity of 1
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int N = 5010;
const int MOD = 1e9+7;
int dp[N][N];
int32_t main()
{
    FAST
    int tt=1;
    //cin >> tt;
    while(tt--)
    {         
      int n,k,q;
      cin>>n>>k>>q;
      int a[n+1];
      for(int i=1;i<=n;i++)
        cin>>a[i];
      for(int i=1;i<=n;i++)
        dp[i][0]=1;
      for(int j=1;j<=k;j++)
      {
        for(int i=1;i<=n;i++)
          dp[i][j]=(dp[i-1][j-1]+dp[i+1][j-1])%MOD; 
      }   
      vector<int> freq(N,0);
      for(int i=1;i<=n;i++)
      {
        for(int j=0;j<=k;j++)
        {
          freq[i]+=(dp[i][j]*dp[i][k-j])%MOD;
          freq[i]%=MOD;  
        }  
      }
      int ans=0;
      for(int i=1;i<=n;i++)
      {
        ans+=(a[i]*freq[i])%MOD;
        ans%=MOD;  
      }
      while(q--)
      {
        int ind,val;
        cin>>ind>>val;
        ans-=(freq[ind]*a[ind])%MOD;
        ans+=MOD;
        ans%=MOD;
        ans+=(freq[ind]*val)%MOD;
        ans%=MOD;
        a[ind]=val;
        cout<<ans<<"\n";
      }
    }
    return 0;
}