#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

const int mod = 1e9 + 7, N = 5005;
int dp[N][N], cnt[N];

void pre(int n, int k){
	for(int i = 0; i < n; i++)	dp[i][0] = 1;
	for(int j = 1; j <= k; 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] = (cnt[i] + (dp[i][j] * dp[i][k-j])%mod)%mod;
	}
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	cout.tie(NULL);
	int n, k, q;	cin >> n >> k >> q;
	pre(n ,k);
	int a[n];	for(int i = 0; i < n; i++)	cin >> a[i];

	int res = 0;	for(int i = 0; i < n; i++) res = (res + (a[i] * cnt[i])%mod)%mod;

	while(q--){
		int idx, val;	cin >> idx >> val;	idx--;
		res = (res - (a[idx] * cnt[idx])%mod + mod)%mod;
		a[idx] = val;
		res = (res + (a[idx] * cnt[idx])%mod)%mod;
		cout << res << endl;
	}
}