#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n + 1], sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d ", &a[i]);
    sum += a[i];
  }
  if (sum % n) {
    printf("%d\n", -1);
    return;
  }
  int all = sum / n;
  vector<vector<int> > v;
  for (int i = 2; i <= n; i++) {
    vector<int> add;
    int x = a[i] % i;
    if (x != 0) x = i - x;
    add.push_back(1);
    add.push_back(i);
    add.push_back(x);
    a[1] -= x;
    a[i] += x;
    v.push_back(add);
    add.clear();
    x = a[i] / i;
    add.push_back(i);
    add.push_back(1);
    add.push_back(x);
    a[1] += x * i;
    a[i] -= x * i;
    v.push_back(add);
    add.clear();
  }
  for (int i = 2; i <= n; i++) {
    vector<int> add;
    int x = all;
    add.push_back(1);
    add.push_back(i);
    add.push_back(x);
    a[1] -= x;
    a[i] += x;
    v.push_back(add);
  }
  printf("%d\n", v.size());
  for (auto x : v) {
    printf("%d %d %d\n", x[0], x[1], x[2]);
  }
  return;
}
int main() {
  int q;
  cin >> q;
  while (q--) solve();
  return 0;
}
