#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 5010;
const int M = 1000000007;

int n, k, q;
int a[maxn];
int f[maxn][maxn], g[maxn][maxn];
int c[maxn];

ll read(){ ll s = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9'){ s = s * 10 + ch - '0'; ch = getchar(); } return s * f; }

int main(){
	n = read(), k = read(), q = read();
	
	for(int i = 1 ; i <= n ; ++i) a[i] = read();
	 
	for(int i = 1 ; i <= n ; ++i) f[0][i] = 1, g[k][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]) % M;
		}
	}
	
	for(int i = k - 1 ; i >= 0 ; --i){
		for(int j = 1 ; j <= n ; ++j){
			g[i][j] = (g[i + 1][j - 1] + g[i + 1][j + 1]) % M;
		} 
	} 
	
	for(int i = 0 ; i <= k ; ++i){
		for(int j = 1 ; j <= n ; ++j){
			c[j] = (c[j] + 1ll * f[i][j] * g[i][j] % M) % M;
		}
	} 
	
	int ans = 0;
	for(int i = 1 ; i <= n ; ++i) ans = (ans + 1ll * c[i] * a[i] % M) % M;
	
	int x, y;
	for(int i = 1 ; i <= q ; ++i){
		x = read(), y = read();
		ans = ((ans - 1ll * a[x] * c[x] % M) % M + M) % M;
		a[x] = y;
		ans = (ans + 1ll * a[x] * c[x] % M) % M;
		printf("%d\n", ans);
	}
	
	return 0;
}