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

typedef long long ll;

const long long N = 5005, mod = 1e9 + 7;
long long dp[N][N], cnt[N], a[N], q, n, k;

void pre() {
    for (int i = 0; i < n; i++)
        dp[i][0] = 1;
        
    for (int j = 1; j < N; j++) {
        dp[0][j] = dp[1][j - 1];
        for (int i = 1; i < n - 1; i++)
            dp[i][j] = (dp[i - 1][j - 1] + dp[i + 1][j - 1]) % mod;
        dp[n - 1][j] = dp[n - 2][j - 1];
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= k; j++)
            cnt[i] += dp[i][j] * dp[i][k - j], cnt[i] %= mod;
    }
}

long long calc(ll i, ll k)
{
    if(i<0||i>=n)
        return 0;
    if(k==0)
        return 1;
    if(dp[i][k]!=-1)
        return dp[i][k];
    ll ans=0;
    ans=(calc(i-1,k-1)+calc(i+1,k-1))%mod;
    dp[i][k]=ans;
    return ans;
}

int main()
{
    // int n,k,q;
    cin>>n>>k>>q;
    for(int i=0;i<n;i++)
        cin>>a[i];
    memset(dp,-1,sizeof(dp));
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=k;j++)
            cnt[i]=(cnt[i]+(calc(i,j)*calc(i,k-j))%mod)%mod;
        sum+=(cnt[i]*a[i])%mod;
    }
    // cout<<sum<<endl;
    for(int i=0;i<q;i++)
    {
        ll id,val;
        cin>>id>>val;
        id--;
        sum = (sum + (cnt[id] * (val-a[id]+mod) % mod)%mod)%mod;
        cout<<sum<<endl;
        a[id]=val;
    }
    return 0;
}