#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef long double ld;

constexpr ll M = 1e9+7;

#define NN 5050
ll n, k;

ll dp[NN][NN];
ll tot[NN];
ll a[NN];

#define DP dp[i][s]

ll r(ll i, ll s) {
	if (~DP) return DP;
	if (s==k) {
		DP=1;
	} else {
		DP = 0;
		if (i) DP += r(i-1, s+1);
		if (i!=n-1) DP += r(i+1, s+1);
		DP %= M;
	}

	return DP;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll q;

	cin>>n>>k>>q;
	for (ll i=0; i<n; ++i) cin>>a[i];
	memset(dp, -1, sizeof dp);
	ll og = 0;
	for (ll i=0; i<n; ++i) for (ll s=0; s<=k; ++s) {
		tot[i] = (tot[i]+r(i, s)*r(i, k-s)%M)%M;
		r(i, s);
	}
	for (ll i=0; i<n; ++i)
		og = (og + a[i]*tot[i])%M;
	while (q--) {
		ll i, x;
		cin>>i>>x;
		--i;
		og = (og - a[i]*tot[i] +M )%M;
		a[i] = x;
		og = (og + a[i]*tot[i] +M )%M;
		cout<<og<<'\n';
	}
}
