#include <bits/stdc++.h>
#define eps 1e-6
using namespace std;
typedef long long ll;
typedef double db;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const int INF = 1e8 + 5;
const ll inf = 1e15 + 8;
ll a[maxn];
ll c[maxn], n, d;
int lowbit(int x) {
return x & -x;
}
void up(int x, ll d) {
while (x < maxn) {
c[x] += d;
c[x] %= mod;
x += lowbit(x);
}
}
ll getsum(int x) {
int ans = 0;
while (x) {
ans += c[x];
ans %= mod;
x -= lowbit(x);
}
return ans;
}
struct TREE {
ll l, r, val, lazy;
void fun(ll tmp) {
lazy += tmp;
val += (r - l + 1) * tmp;
}
} tre[maxn*4];
void PushDown(int id) {
if (tre[id].lazy) {
tre[id<<1].fun(tre[id].lazy);
tre[id<<1|1].fun(tre[id].lazy);
tre[id].lazy = 0;
}
}
void PushUp(int id) {
tre[id].val = tre[id<<1].val + tre[id<<1|1].val;
}
void build(int id, int l, int r) {
tre[id].l = l, tre[id].r = r, tre[id].lazy = 0;
if (l == r) tre[id].val = 0;
else {
int mid = (l + r) >> 1;
build(id<<1, l, mid);
build(id<<1|1, mid+1, r);
PushUp(id);
}
}
void update(int id, int st, int ed, int val) {
int l = tre[id].l, r = tre[id].r;
if (st <= l && ed >= r) tre[id].fun(val);
else {
PushDown(id);
int mid = l + r >> 1;
if (st <= mid) update(id<<1, st, ed, val);
if (ed > mid) update(id<<1|1, st, ed, val);
PushUp(id);
}
}
ll query(int id, int st, int ed) {
int l = tre[id].l, r = tre[id].r;
if (st <= l && ed >= r) return tre[id].val;
else {
PushDown(id);
int mid = l + r >> 1;
ll sum1 = 0, sum2 = 0;
if (st <= mid) sum1 = query(id<<1, st, ed);
if (ed > mid) sum2 = query(id<<1|1, st, ed);
PushUp(id);
return sum1 + sum2;
}
}
void solve() {
int m;
scanf("%lld%d%lld",&n,&m,&d);
for (int i = 1; i <= n; i++) scanf("%lld", a + i);
memset(c, 0, sizeof(c));
build(1, 1, n);
ll tot = 0;
while (m--) {
int op, x, y; scanf("%d%d", &op, &x);
if (op == 1) {
scanf("%d", &y);
up(x, y);
update(1, x + 1, n , 1);
}
else {
ll tmp = getsum(x) + query(1, 1, x) * d + a[x];
printf("%lld\n", tmp % mod);
a[x] -= tmp;
//printf("a[x] = %d\n",a[x]);
}
}
}
int main(){
freopen("in.txt", "r", stdin);
int t = 1;
scanf("%d",&t);
while (t--) {
solve();
}
return 0;
}