You are given an array a consisting of nn positive integers, numbered from 11 to nn. You can perform the following operation no more than 3n3n times:

  • choose three integers i,ji, j and xx (1i,jn;0x109)(1≤i,j≤n; 0≤x≤10^9);
  • assign ai:=aixia_i:=a_i−x⋅i, aj:=aj+xia_j:=a_j+x⋅i.
    After each operation, all elements of the array should be non-negative.
    Can you find a sequence of no more than 3n3n operations after which all elements of the array are equal?

Input

The first line contains one integer tt (1t1041≤t≤10^4) — the number of test cases. Then tt test cases follow.
The first line of each test case contains one integer nn (1n1041≤n≤10^4) — the number of elements in the array. The second line contains nn integers a1,a2,,ana_1,a_2,\cdots,a_n (1ai1051≤a_i≤10^5) — the elements of the array.
It is guaranteed that the sum of nn over all test cases does not exceed 10410^4.

Output

For each test case print the answer to it as follows:
if there is no suitable sequence of operations, print 1−1;
otherwise, print one integer kk (0k3n0≤k≤3n) — the number of operations in the sequence. Then print kk lines, the mm-th of which should contain three integers i,ji, j and xx (1i,jn1≤i,j≤n, 0x1090≤x≤10^9) for the mm-th operation.
If there are multiple suitable sequences of operations, print any of them. Note that you don’t have to minimize kk.

Example

input

1
2
3
4
5
6
7
3
4
2 16 4 18
6
1 2 3 4 5 6
5
11 19 1 1 3

output

1
2
3
4
5
6
7
8
9
2
4 1 2
2 3 3
-1
4
1 2 4
2 4 5
2 3 3
4 5 1

Idea

对于 ai:=aixia_i:=a_i−x⋅i, aj:=aj+xia_j:=a_j+x⋅i,取 i=1i=1,则 a1:=a1xa_1:=a_1-xaj:=aj+xa_j:=a_j+x;取 j=1j=1,则 a1:=a1+xia_1:=a_1+x\cdot iai:=aixia_i:=a_i-x\cdot i
可以从 a1a_1 中取出任何数字补充到 aja_j 上,也可以从 aia_i 中取出 ii 的倍数补充到 a1a_1 上。
不妨考虑首先将序列 aa 的和全部堆在 a1a_1 上。若 iaii\mid a_i,那么就取 x=aiix=\frac{a_i}{i},操作完成后,a1:=a1+aia_1:=a_1+a_iai=0a_i=0。若 i∤aii\not\mid a_i,那么取 x=i(aimodi)x=i-(a_i\bmod i),操作完成后,a1:=a1i+(aimodi)a_1:=a_1-i+(a_i\bmod i)ai:=ai+i(aimodi)a_i:=a_i+i-(a_i\bmod i),这时候就有 aiia_i\mid i。至多经过 2(n1)2(n-1) 次操作,a1:=i=1naia_1:=\sum\limits_{i=1}^n a_i,除 a1a_1 外,其余元素都为 00
最后经过 nn 次操作,将 i=1nain\frac{\sum\limits_{i=1}^n a_i}{n} 分配到其余各个元素。当 n∤i=1nain\not\mid\sum\limits_{i=1}^n a_i 时,不能完成操作。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/******************************************************************
Copyright: 11D_Beyonder All Rights Reserved
Author: 11D_Beyonder
Problem ID: CF1416B
Date: 9/28/2020
Description: Constructive Algorithms
*******************************************************************/
#include<iostream>
#include<utility>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int N=10005;
int _;
int n;
ll a[N];
vector<pair<pair<int,int>,ll>>ans;
int main(){
for(cin>>_;_;_--){
ans.clear();
scanf("%d",&n);
int i;
ll sum=0;
for(i=1;i<=n;i++){
scanf("%lld",&a[i]);
sum+=a[i];
}
if(sum%n){
puts("-1");
continue;
}
for(i=2;i<=n;i++){
if(a[i]%i){
ans.push_back(make_pair(make_pair(1,i),i-a[i]%i));
a[i]+=i-a[i]%i;
}
ans.push_back(make_pair(make_pair(i,1),a[i]/i));
}
for(i=2;i<=n;i++){
ans.push_back(make_pair(make_pair(1,i),sum/n));
}
printf("%d\n",ans.size());
for(i=0;i<ans.size();i++){
printf("%d %d %d\n",ans[i].first.first,ans[i].first.second,ans[i].second);
}
}
return 0;
}