#include <bits/stdc++.h>
using namespace std;


typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

template<class T> void aIn(T *a, int n){
    for(int i=0;i<n;i++)
        std::cin>>a[i];
}
template<class T> void aOut(T *a, int n){
    for(int i=0;i<n;i++)
        std::cout<<a[i]<<" ";
    std::cout<<endl;
}
template<class T> void vOut(vector<T> &a){
    for(T &x: a)
        std::cout<<x<<" ";
    std::cout<<endl;
}

const int N = 5e3+10;
const int M = 1e9 + 7;

int n,k,q;

int64 cnt[N][N] ;
int64 mul[N];

int sith_dooku(int pos,int k){
    if( k<0 ) return 0;
    if( pos < 0 || pos >= n ) return 0;

    if( k == 0 )
        return (cnt[pos][k] = 1);   
           
    if( cnt[pos][k] )
        return cnt[pos][k];

    cnt[pos][k] = (sith_dooku(pos+1,k-1) + sith_dooku(pos-1,k-1) )%M;
    return cnt[pos][k];
}


void solve(){
    cin>>n>>k>>q;
    int64 a[n];
    aIn(a,n);

    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++)
            cnt[i][j] = 0;
        mul[i] = 0;
    }    
    for(int i=0;i<n;i++)
        sith_dooku(i,k);

    for(int pos=0;pos<n;pos++){
        for(int i=0;i<=k;i++)
            mul[pos] = (mul[pos]+(cnt[pos][i]*cnt[pos][k-i])%M)%M;
    }

    int64 ans = 0ll;

    for(int i=0;i<n;i++){
        ans = (ans+(a[i]*mul[i])%M)%M;
    }
  //  aOut(mul,n);
  //  cout<<ans<<endl;

    while(q--){
        int pos,num;
        cin>>pos>>num;
        pos--;
        ans = (ans+M+((num-a[pos])*mul[pos])%M)%M;
        a[pos] = num;
        cout<<ans<<endl;
    }
}

int main(){
    ios::sync_with_stdio(false);
    int t = 1;
 //   cin >> t;
    while(t--){
        solve();
    }
}