#include<bits/stdc++.h>
using namespace std;
const int N=5e3+2,D=1e9+7;
#define int long long
int n,k,q,a[N],f[N][N],g[N],A,x,y;
signed main()
{
	cin>>n>>k>>q;
	for(int i=1;i<=n;i++)
		cin>>a[i],f[0][i]=1;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=n;j++)
			f[i][j]=(f[i-1][j-1]+f[i-1][j+1])%D;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=k;j++)
			(g[i]+=f[j][i]*f[k-j][i])%=D;
	for(int i=1;i<=n;i++)
		(A+=g[i]*a[i])%=D;
	while(q--&&cin>>x>>y)
	{
		(A+=g[x]*(y-a[x]))%=D,a[x]=y;
		cout<<(A+D)%D<<'\n';
	}
	return 0;
}
