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

ll num[5005];
ll vis[5005][5005];
ll vit[5005];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    int n, k, q;
    cin >> n >> k >> q;
    for (int i = 1; i <= n; i++) {
        cin >> num[i];
        vis[i][0] = 1;
    }

    for(int j = 1; j <= k; j++) {
        for(int i = 1; i <= n; i++) {
            vis[i][j] += vis[i - 1][j - 1] + vis[i + 1][j - 1];
            vis[i][j] %= MOD;
        }
    }

    for (int i = 1; i <= n; i++) {
        for(int j = 0; j <= k; j++) {
            vit[i] = (vit[i] + (vis[i][j] * vis[i][k - j]) % MOD) % MOD;
        }
    }

    ll sum = 0;
    for (int i = 1; i <= n; i++) {
//        cout << vit[i] << " ";
        sum = (sum + vit[i] * num[i] % MOD) % MOD;
    }
//    cout << endl;

    while (q--) {
        ll a, b;
        cin >> a >> b;
        sum = (sum + ((b - num[a]) * vit[a]) % MOD) % MOD;
        sum = (sum + MOD) % MOD;
        num[a] = b;
        cout << sum << endl;
    }





    return 0;
}