
#include <bits/stdc++.h>
   
#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) <<"\n"
#define test ll t;cin>>t;while(t--)
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 5e3+10;
const ll inf = 8e12;

ll dp[MAX][MAX],a[MAX],aux[MAX];
int main(){
  fastio; 
  ll n,k,q;
  cin>>n>>k>>q;
  f(i,0,MAX){
    dp[0][i] = 1;
  }
  f(i,1,n+1) cin>>a[i];
  f(i,0,k){
    f(j,1,n+1){
      if(j>1)(dp[i+1][j-1]+=dp[i][j])%=mod;
      if(j<n)(dp[i+1][j+1]+=dp[i][j])%=mod;
    }
  }
  ll ans = 0;
  f(i,1,n+1){
    f(j,0,k+1) aux[i]=(aux[i]+dp[j][i]*dp[k-j][i])%mod;
    ans=(ans+aux[i]*a[i])%mod;
  }
  while(q--){
    ll pos,x;
    cin>>pos>>x;
    ans=(ans+aux[pos]*(x-a[pos]))%mod;
    if(ans<0)ans+=mod;
    a[pos] = x;
    cout<<ans<<"\n";
  }
  return 0;  
  }    