#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int>pii;
typedef vector<int>vi;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define fi first
#define se second
#define de(x) cout<<#x<<"="<<x<<"\n"
#define dd(x) cout<<#x<<"="<<x<<" "
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lowbit(a) ((a)&-(a))
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define mp make_pair
#define sec ((clock_t)1000)
const int N = 5e3 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
inline int add(int a,int b){return a + b >= mod?a + b - mod:a + b;}
inline int mul(int a,int b){return (ll)a*b%mod;}
int n , k , q;
int cnt[N][N],a[N],b[N];
int main(){
	scanf("%d%d%d",&n,&k,&q);
	rep(i , 1 , n + 1)cnt[0][i] = 1;
	rep(i , 1 , k + 1){
		rep(j , 1 , n + 1)
			cnt[i][j] = add(cnt[i - 1][j - 1] , cnt[i - 1][j + 1]);
	}
	rep(i , 0 ,k + 1){
		rep(j , 1 , n + 1)
			a[j] = add(a[j],mul(cnt[i][j],cnt[k - i][j]));
	}
	rep(i , 1 , n + 1)scanf("%d",&b[i]);
	int ans = 0,x,y;
	rep(i , 1 , n + 1)ans = add(ans,mul(a[i],b[i]));
	while(q--){
		scanf("%d%d",&x,&y);
		int dif = add(y ,mod - b[x]);
		ans = add(ans,mul(dif,a[x]));
		b[x] = y;
		printf("%d\n",ans);
	}
	return 0;
}
