#include<cstdio>
#include<algorithm>
using namespace std;
#define LL long long
const int maxn = 5e3 + 5;
const LL mod = 1e9 + 7;

LL x[maxn], cnt[maxn];
LL dp[maxn][maxn];
int main()
{
    // freopen("in.txt","r",stdin);
    int n, k, q;scanf("%d %d %d",&n,&k,&q);
    for(int i = 1;i <= n;i++)scanf("%lld",&x[i]),dp[i][0] = 1;

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

    LL ans = 0;
    for(int i = 1;i <= n;i++)ans = (ans + cnt[i] * x[i] % mod) % mod;

    while(q--)
    {
        int index;LL val;
        scanf("%d %lld",&index,&val);
        ans = (ans + mod - cnt[index] * x[index] % mod) % mod;
        ans = (ans + cnt[index] * val % mod) % mod;
        x[index] = val;
        printf("%lld\n",ans);
    }
    return 0;
}