#include <bits/stdc++.h>
using namespace std;
int fastio() { ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin.tie(nullptr); return 0; }
int __fastio = fastio();

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
typedef long long ll;
typedef pair<ll, ll> ii;
#define fi first
#define se second
#define sz(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const int N = 5005, mod = 1e9+7;
ll dp[N][N]; // num ways reach x after y steps dp[y][x]
ll sumDP[N];

int main(){
    int n, k, q;
    cin >> n >> k >> q;
    vector<ll> vals(n);
    for(int i=0;i<n;i++) cin >> vals[i];
    for(int i=0;i<n;i++) dp[0][i] = 1;

    for(int i=0;i<k;i++) {
        for(int j=0;j<n;j++) {
            if(j) dp[i+1][j-1] = (dp[i+1][j-1] + dp[i][j]) % mod;
            if(j+1<n) dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j]) % mod;
        }
    }
    for(int i=0;i<=k;i++) {
        int left = k-i;
        for(int j=0;j<n;j++) {
            ll ways = dp[i][j];
            ways *= dp[left][j];
            sumDP[j] = (sumDP[j] + ways%mod) % mod;
        }
    }
    ll curCost = 0;
    for(int i=0;i<n;i++) curCost = (curCost + sumDP[i]*vals[i]) % mod;

    int a;
    ll b;
    while(q--) {
        cin >> a >> b;
        a--;
        ll old = vals[a];
        curCost -= sumDP[a]*old;
        vals[a] = b;
        curCost += sumDP[a]*b;
        curCost = ((curCost%mod)+mod)%mod;
        cout << curCost << "\n";
    }
}
