#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <memory>
#include <set>
#include <algorithm>

using namespace std;
#define MAX 5009
long long MOD = 1000000007;

long long mas[MAX];
long long matr[MAX][MAX];
long long matr2[MAX][MAX];
int N, K, Q;

int main() {
	cin >> N >> K >> Q;
	memset(matr, 0, sizeof(matr));
	memset(matr2, 0, sizeof(matr2));
	for (int j = 0; j < N; j++)
		matr[0][j] = 1;
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j < N; j++) {
			if (j > 0)
				matr[i][j] = (matr[i][j] + matr[i - 1][j - 1]) % MOD;
			if (j + 1 < N)
				matr[i][j] = (matr[i][j] + matr[i - 1][j + 1]) % MOD;
		}
	}
	for (int i = 0; i <= K; i++) {
		for (int j = 0; j < N; j++) {
			matr2[i][j] = (matr[i][j] * matr[K - i][j]) % MOD;
		}
	}
	for (int i = 0; i <= K; i++) {
		for (int j = 0; j < N; j++) {
			matr[i][j] = matr2[i][j];
		}
	}
	/*long long m2 = 1;
	for (int i = K; i >= 0; i--) {
		for (int j = 0; j < N; j++)
			matr[i][j] = (matr[i][j] * m2) % MOD;
		m2 = (m2 * 2) % MOD;
	}*/
	long long sum[MAX];
	memset(sum, 0, sizeof(sum));
	for (int i = 0; i <= K; i++)
		for (int j = 0; j < N; j++)
			sum[j] = (sum[j] + matr[i][j]) % MOD;

	for (int i = 0; i < N; i++)
		cin >> mas[i];

	long long res = 0;
	for (int i = 0; i < N; i++)
		res = (res + sum[i] * mas[i]) % MOD;

	for (int q = 0; q < Q; q++) {
		int index;
		long long val;
		cin >> index >> val;
		index--;
		res = (res - mas[index] * sum[index] + val * sum[index] + MOD * MOD) % MOD;
		mas[index] = val;
		cout << res << "\n";
	}


	return 0;
}