Problem: There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.

In one move, the robot must move one cell to the left or right, provided that it doesn't move out of bounds. In other words, if the robot was in the cell i, it must move to either the cell i-1 or the cell i+1, as long as it lies between 1 and n (endpoints inclusive). The cells, in the order they are visited (including the cell the robot is placed), together make a good path.

Each cell i has a value a_i associated with it. Let c_0, c_1, ..., c_k be the sequence of cells in a good path in the order they are visited (c_0 is the cell robot is initially placed, c_1 is the cell where the robot is after its first move, and so on; more formally, c_i is the cell that the robot is at after i moves). Then the value of the path is calculated as a_{c_0} + a_{c_1} + ... + a_{c_k}.

Your task is to calculate the sum of values over all possible good paths. Since this number can be very large, output it modulo 10^9 + 7. Two good paths are considered different if the starting cell differs or there exists an integer i ∈ [1, k] such that the current cell of the robot after exactly i moves is different in those paths.

You must process q updates to a and print the updated sum each time. Each update changes the value of exactly one cell. See the input format and the sample input-output for more details.

Input

The first line of the input contains three space-separated integers n, k and q (2 ≤ n ≤ 5000; 1 ≤ k ≤ 5000; 1 ≤ q ≤ 2 ⋅ 10^5).

The second line of the input contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9).

q lines follow. Each line contains two space-separated integers i and x (1 ≤ i ≤ n; 1 ≤ x ≤ 10^9) indicating that you must change the value of a_i to x.

Output

Print q integers. The i-th integer should be the sum of values over all good paths after the first i updates are performed. Since the answers may be large, print them modulo 10^9 + 7.

Examples

Input


5 1 5
3 5 1 4 2
1 9
2 4
3 6
4 6
5 2


Output


62
58
78
86
86


Input


5 2 5
3 5 1 4 2
1 9
2 4
3 6
4 6
5 2


Output


157
147
207
227
227


Input


4 40 6
92 21 82 46
3 56
1 72
4 28
1 97
2 49
2 88


Output


239185261
666314041
50729936
516818968
766409450
756910476

Note

In the first example, the good paths are (1, 2), (2, 1), (2, 3), (3, 2), (3, 4), (4, 3), (4, 5), (5, 4).

Initially the values of a are [3, 5, 1, 4, 2]. After the first update, they become [9, 5, 1, 4, 2]. After the second update, they become [9, 4, 1, 4, 2], and so on.

Solution (in CPP):

Solution:
#include <iostream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<cstdlib>
#include<time.h>
#include<math.h>
#include<cmath>
#include<stdlib.h>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
using namespace std;
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
typedef long long LL;
typedef long long ll;
typedef pair<LL, LL> pll;
typedef pair<signed, signed>P;
using namespace std;
#define int long long
//int n, m,k;
//const int maxn =
/*inline int gcd(int a, int b) { return b ? gcd(b, a%b) : a; };
int a[maxn], rk[maxn], tree[maxn],mx[maxn], tag[maxn], mod,
x, y, z, S, cnt;
int large[maxn], seg[maxn], fa[maxn], vis[maxn], dep[maxn], son[maxn];
int top[maxn];
int head[maxn];
int id[maxn];
int f1[maxn][20];
struct edge
{
	int nex, from, to;
}eds[maxn];
int tot;
int arr[maxn];
void pushup(int rt);
void build(int rt, int l, int r)
{
	int md = mid;
	if (l == r)
	{
		mx[rt] = tree[rt] = arr[rk[l]];
	}
	build(lson, l, md);
	build(rson, md + 1, r);
	pushup(rt);
}
int query(int rt, int l, int r, int L, int R)
{
	if (L <= l && r <= R)return tree[rt];
	int m = mid, res = 0;
	if (L <= m)res += query(lson, l, m, L, R);
	if (R > m)res += query(rson, m + 1, r, L, R);
	pushup(rt);
	return res;
}
int query1(int rt, int l, int r, int L,  int R)
{
	if (L <= l && r <= R)return mx[rt];
	int m = mid, res = 0;
	if (L <= m)res = max(res, query1(lson, l, m, L, R));
	else res = max(res, query1(rson, m + 1, r, L, R));
	pushup(rt);
	return res;
}
void pushup(int rt)
{
	mx[rt] = max(mx[lson], mx[rson]);
	tree[rt] = tree[lson] + tree[rson];
}

void update(int rt, int l, int r, int L, int R, int val)
{
	if (L <= l && r <= R)
	{
		tree[rt] = val * (r - l + 1);
		mx[rt] = val;
	}
	else
	{
		int m = mid;
		if (L <= m)update(lson, l, m, L, R, val);
		if (R > m)update(rson, m + 1, r, L, R, val);
		pushup(rt);
	}
}
void dfs1(int x, int f)
{
	large[x] = 1, fa[x] = f;
	f1[x][0] = f;
	for (int i = 1; (1 << i) <= dep[x]; i++)
		f1[x][i] = f1[f1[x][i - 1]][i - 1];
	dep[x] = dep[f] + 1;
	int maxy = 0;
	for (int i = head[x]; i != -1; i = eds[i].nex)
	{
		int u = eds[i].to, big = 0;
		if (u == f)continue;
		dfs1(u, x);
		large[x] += large[u];
		if (large[u] > maxy)son[x] = u, maxy = large[u];
	}
}
void dfs2(int x, int f)
{
	top[x] = f, id[x] = ++tot, rk[tot] = x;
	if (son[x])dfs2(son[x], f);
	for (int i = head[x]; i != -1; i = eds[i].nex)
	{
		int u = eds[i].to;
		if (u != son[x]&&u!= fa[x])dfs2(u, u);
	}
}
inline int sum(int x, int y)
{
	LL ans = 0;
	while (top[x] != top[y])
	{
		if (dep[top[x]] < dep[top[y]])swap(x, y);
		ans += query(1, 1, n, id[top[x]], id[x]);
		x = fa[top[x]];
	}
	if (dep[x] > dep[y])swap(x, y);
	return ans + query(1, 1, n, id[x], id[y]);
}
inline int Max(int x, int y)
{
	int ans = -1e9;
	while (top[x] != top[y])
	{
		if (dep[top[x]] < dep[top[y]])swap(x, y);
		ans = max(ans, query1(1, 1, n, id[top[x]], id[x]));
		x = fa[top[x]];
	}
	if (dep[x] > dep[y])swap(x, y);
	return max(ans, query1(1, 1, n, id[x], id[y]));
}
void add(int x, int y)
{
	cnt++;
	eds[cnt].from = x, eds[cnt].to = y;
	eds[cnt].nex = head[x], head[x] = cnt;
}

void updatelong(int x, int y, int z)
{
	while (top[x] != top[y])
		if (dep[top[x]] <= dep[top[y]])
			update(1, 1, n, id[top[y]], id[y], z), y = fa[top[y]];
		else update(1, 1, n, id[top[x]], id[x], z), x = fa[top[x]];
	if (dep[x] > dep[y])swap(x, y);
	update(1, 1, n, id[x], id[y], z);
}
P lca(int a, int b)
{
	bool swa = 0;
	if (dep[a] > dep[b])swa = 1, swap(a, b);
	int tempb = b;
	for (int i = 19; i >= 0; i--)
		if (dep[a] <= dep[b] - (1 << i))b = f1[b][i];
	if (a == b)
	{
		b = tempb;
		for (int i = 19; i >= 0; i--)
			if (dep[a]-1 <= dep[b] - (1 << i))b = f1[b][i];
		return make_pair(b, b);
	}
	for (int i = 19; i >= 0; i--)
		if (f1[a][i] == f1[b][i])continue;
		else a = f1[a][i], b = f1[b][i];
	if (swa)swap(a, b);
	return make_pair(a, b);
}*/
inline signed gcd(signed a, signed b) { return b ? gcd(b, a%b) : a; };
const LL mod = 1e9+7;
LL QPow(LL a, LL b)
{
	LL as = 1;
	if (b < 0)return 0;
	while (b)
	{
		if (b & 1)as = as * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return as;
}

/*int arr[2*maxn];
vector<signed>g[maxn];
bool inCircle[maxn];
bool vis[maxn];
int d[maxn];
signed son[maxn];
inline signed dfs(int u, int f,int dep)
{
	int curDep = dep;
	vis[u] = 1;
	//cout << u <<" "<<dep<< endl;
	d[u] = dep;
	for (auto v : g[u])
		if (v != f)
			if (vis[v])curDep = min(curDep, d[v]);// , cout << u << "*" << v << " " << d[v] << endl;
			else curDep=min((signed)curDep,dfs(v, u, dep + 1));
	d[u] = curDep;
	if (d[u] < dep)inCircle[u] = 1;
	//if (u == 7)cout << "7:" << d[u] << " " << dep << endl;
	return d[u];
}
int id = 0, cur = 0;
int a, b;
inline signed dfs2(int u, int f)
{
	son[u] = 1;
	vis[u] = 1;
	if (u == b)id = cur;
	for (int i = 0; i < g[u].size(); i++)
	{
		int v = g[u][i];
		if (u == a)
			cur = i;
		if (v != f&&!vis[v])
			son[u] += dfs2(v, u);
	}
	return son[u];
}

*/
/*LL fac[maxn], fac_1[maxn];
LL inv[maxn];
LL arr[maxn];
void getInv()
{
	inv[1] = 1;
	for (int i = 2; i < maxn; i++)
		inv[i] = (mod - mod / i)*inv[mod%i] % mod;
}
void init()
{
	fac[0] = fac_1[0] = 1;
	for (int i = 1; i < maxn; i++)
		fac[i] = i * fac[i - 1] % mod,
		fac_1[i] = inv[i]*fac_1[i - 1] % mod;
}
LL C(int n, int m)
{
	if (m > n || m < 0 || n < 0)return 0;
	return fac[n] * fac_1[n - m]%mod * fac_1[m] % mod;
}
*/
inline int rd() {
	int ans = 0; char last = ' ', ch = getchar();
	while (!(ch >= '0' && ch <= '9'))last = ch, ch = getchar();
	while (ch >= '0' && ch <= '9')ans = ans * 10 + ch - '0', ch = getchar();
	if (last == '-')ans = -ans;
	return ans;
}
const int maxn = 5e3 + 5;
int arr1[maxn],arr2[maxn],arr3[maxn];
signed vis[maxn];
int sum[30];
int arr[maxn];
int dp[maxn][maxn];
int tot[maxn];
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t, n,m,n1,n2,n3,k,q,i,x;
	//mainL();
	cin >> n >> k >> q;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	for (int i = k; i >= 0; i--)
	{
		if (i != k)
			for (int j = 1; j <= n; j++)
			{
				dp[i][j] = dp[i + 1][j + 1] + dp[i + 1][j - 1];
				dp[i][j] %= mod;
			}
		else
			for (int i = 1; i <= n; i++)
				dp[k][i] = 1;
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= k; j++)
		{
			tot[i] += dp[j][i]*dp[k-j][i]%mod;
			tot[i] %= mod;
		}
	}
	int sum = 0;
	for (int i = 1; i <= n; i++)
		sum += tot[i] * arr[i] % mod, sum %= mod;
	while (q--)
	{
		cin >> i >> x;
		sum += (x - arr[i])*tot[i];
		sum %= mod, sum += mod, sum %= mod;
		arr[i] = x;
		cout << sum << '\n';
	}
	/*cin >> t;
	while (t--)
	{
		cin >> n;
		for (int i = 1; i <= n; i++)cin >> arr[i];
		int mx = 0;
		int sum = 0;
		for (int i = 2; i < n; i++)
			if (arr[i] > arr[i + 1] && arr[i] > arr[i - 1] || arr[i] < arr[i + 1] && arr[i] < arr[i - 1])
				sum += 1,vis[i]=1;
		mx = min(sum, (LL)1);
		for (int i = 2; i < n; i++)
		{
			if (vis[i])
			{
				mx = max(mx, (LL)1);
				if (vis[i + 1])
				{
					mx = max(mx, (LL)2);
					if (vis[i + 2])
						mx = max(mx, LL(3));
				}
			}
		}
		cout << sum - mx << endl;
		for (int i = 0; i <= n; i++)
			vis[i] = 0;
	 
	}*/
	//cin >> n1 >> n2 >> n3;
	
	//system("pause");
	return 0;
}
signed mainL()
{
	int arr[maxn];
	string strs[102];
	string old[202];
	bool vis[1];
	int fr[202];
	cout << arr[0];
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t, n, k, y, x, m, u, v, da, db;
	cin >> n;
	map<string, signed>mp;
	for (int i = 1; i <= n; i++)cin >> strs[i],old[i]=strs[i];
	int len = strs[1].size();
	for (int i = 1; i <= n; i++)
	{
		mp[strs[i]] = i;
		strs[i] += strs[i];
	}
	for (int i = 1; i <= n; i++)
	{
		if (mp[old[i]] != i)continue;
		for (int j = 0; j < len; j++)
		{
			string tmp = "";
			for (int k = 0; k < len; k++)
			{
				tmp.push_back(strs[i][j + k]);
			}
			//cout << tmp << endl;
			if(mp.count(tmp))mp[tmp] = i;
		}
	}
	for (auto it : mp)vis[it.second] = 1;
	int cnt = 0;
	for (int i = 1; i <= 200; i++)
	{
		cnt += vis[i];
	}
	cout << cnt << endl;
	system("pause");
	return 0;
}