#include <bits/stdc++.h>

#define endl '\n'
#define pb push_back
#define pll pair<long long, long long>
#define all(v) v.begin(), v.end()
#define ll long long int
#define fi first
#define se second

using namespace std;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
 
ostream& operator<< (ostream& a, const pll b) {
    cout << "{" << b.first << ", " << b.second << "}";
    return a;
}
 
ostream& operator<< (ostream& a, const vector<ll>& b) {
    for (auto& k : b) cout << k << " ";
    return a;
}
 
ostream& operator<< (ostream& a, const vector<pll>& b) {
    for (auto& k : b) cout << k << " ";
    return a;
}
 
#ifdef HOME 
#define dbg(x) cout << #x << " : " << (x) << '\n';
#else
#define dbg(x)
#endif                 

const ll INF = (ll)1e18;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll maxn = 5e3 + 10, L = 22;

ll dp[maxn][maxn];
ll cnt[maxn], a[maxn];

int main () {
#ifdef HOME
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#else
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
  ll n, k, q;
  cin >> n >> k >> q;
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
    dp[i][0] = 1;
  }
  for (ll j = 1; j <= k; ++j) {
    dp[0][j] = dp[1][j - 1];
    dp[n - 1][j] = dp[n - 2][j - 1];
    for (ll i = 1; i < n - 1; ++i) {
      dp[i][j] = (dp[i - 1][j - 1] + dp[i + 1][j - 1]) % MOD;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    for (ll j = 0; j <= k; ++j)
      cnt[i] = (cnt[i] + dp[i][j] * dp[i][k - j]) % MOD;
    ans = ((cnt[i] * a[i]) % MOD + ans) % MOD;
  }
  while (q--) {
    ll i, x;
    cin >> i >> x;
    --i;
    ans -= (cnt[i] * a[i]) % MOD;
    ans += MOD;
    ans %= MOD;
    a[i] = x;
    ans += (cnt[i] * a[i]) % MOD;
    ans %= MOD;
    cout << ans << endl;
  }
  return 0;
}
































