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

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

#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 5;
const long long INF = 0x3f3f3f3f3f3f;
int a[maxn];
int n;
int judge(int x) {
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += a[i] - x;
  }
  return sum;
}
struct op {
  int i, j, x;
};
vector<op> v;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    v.clear();
    long long sum = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      sum += a[i];
    }
    if (sum % n) {
      cout << -1 << endl;
      continue;
    }
    long long avg = sum / n;
    cout << 3 * (n - 1) << endl;
    for (int i = 2; i <= n; ++i) {
      cout << 1 << " " << i << " " << i - a[i] % i << endl;
      cout << i << " " << 1 << " " << ceil(1.0 * a[i] / i) << endl;
    }
    for (int i = 2; i <= n; ++i) {
      cout << 1 << " " << i << " " << avg << endl;
    }
  }
  return 0;
}
