#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define ll long long
const ll mod = 1e9 + 7;

ll a[5010];
ll dp[5010][5010];
ll culc[5010];
int main() {
    int n, k, q;
    cin >> n >> k >> q;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        dp[0][i] = 1; 
    }
    for (int i = 0; i < k; i++) {
        for (int j = 1; j <= n; j++) {
            dp[i][j] %= mod;
            if (j != 1) dp[i + 1][j - 1] += dp[i][j];
            if (j != n) dp[i + 1][j + 1] += dp[i][j];
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= k; j++) {
            culc[i] += dp[j][i] * dp[k - j][i];
            culc[i] %= mod;
        }
        ans += culc[i] * a[i];
        ans %= mod;
    }
    for (int i = 0; i < q; i++) {
        int idx, x;
        cin >> idx >> x;
        ans = ((ans - culc[idx] * (a[idx] - x)) % mod + mod) % mod;
        a[idx] = x;
        cout << ans << endl;
    }
    return 0;
}