#include <iostream>
#include <map>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <iomanip>
#include <bitset>

#include <time.h>
using namespace std;
long long coef[5001] , res1[5001][5001], res[5001][5001],q, kq = 0 , mod = 1e9+7 , n , k , a[5001];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	//cin >> t;
	//srand (time(NULL));

	while (t--)
	{
		cin >> n >> k >>q ;
		for (int i = 1 ; i <= n ; i++)
		{
			cin >> a[i];
		}
		for (int e = 0 ; e <= k ; e++)
		{
			for (int i = 1 ; i <= n ; i++)
			{
				if (e == 0) res[i][e] = 1;
				else
				{
					if (i > 1)
					{
						res[i][e] += res[i-1][e-1];
					}
					if (i < n)
					{
						res[i][e] += res[i+1][e-1];
					}
					res[i][e] %= mod;
				}
				//cout <<"res["<<i<<"]["<<e<<"] : "<<res[i][e]<<'\n';
				}
		}
		for (int e = 0 ; e <= k ; e++)
		{
			for (int i = 1 ; i <= n ; i++)
			{
				if (e == 0 || e == k) res1[i][e] = res[i][k];
				else
				{
					if (i > 1)
					{
						res1[i][e] = res[i-1][e-1] * res[i-1][k - e - 1] % mod;
					}
					if (i < n)
					{
						res1[i][e] += res[i+1][e-1] * res[i+1][k - e - 1] % mod;
					}
					if (i > 1 && i < n)
					{
						res1[i][e] += res[i+1][e-1] * res[i-1][k - e - 1] % mod;
						res1[i][e] += res[i-1][e-1] * res[i+1][k - e - 1] % mod;
					}
					res1[i][e] %= mod;
				}	
				//cout <<res1[i][e]<<" "<<i<<" "<<e<<'\n';
				coef[i] += res1[i][e];
				coef[i] %= mod;
			}
		}
		for (int i = 1 ; i <= n ; i++)
		{
			kq += a[i] * coef[i] % mod;
			kq %= mod;
		}
		for (int i = 1 ; i <= q ; i++)
		{
			int x , y;
			cin >> x >> y;
			kq -= a[x] * coef[x] % mod;
			kq += mod;
			kq %= mod;
			a[x] = y;
			kq += a[x] * coef[x] % mod;
			kq %= mod;
			cout << kq<<'\n';
		}
	}
}



