#include<bits/stdc++.h>
using namespace std;
const int N=5010;
const long long mod=1e9+7;
long long read(void)
{
	char ch=getchar();long long sum=0;bool f=0;
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-'){f=1;ch=getchar();}
	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	if(f)sum=-sum;return sum;
}
int n,m,Q;
long long A[N],Dp[N][N],Cnt[N],Ans;
void solve(void)
{
	n=read();m=read();Q=read();
	for(int i=1;i<=n;i++)A[i]=read();
	for(int i=1;i<=n;i++)Dp[i][0]=1;
	for(int now=1;now<=m;now++)
		for(int i=1;i<=n;i++){
			Dp[i][now]+=Dp[i-1][now-1];
			Dp[i][now]+=Dp[i+1][now-1];
			Dp[i][now]%=mod;
		}
	for(int i=1;i<=n;i++){
		for(int j=0;j<=m;j++)Cnt[i]=(Cnt[i]+Dp[i][j]*Dp[i][m-j]%mod)%mod;
	}
	for(int i=1;i<=n;i++)Ans=(Ans+A[i]*Cnt[i]%mod)%mod;
	for(int i=1,x,t;i<=Q;i++)
	{
		x=read();t=read();
		Ans+=(mod+t-A[x])*Cnt[x]%mod;Ans%=mod;
		A[x]=t;
		cout<<Ans<<endl;
	}return;
	
}
int main()
{
	solve();
	return 0;
} 
