#include <bits/stdc++.h>
using namespace std;
void Main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  if (s % n != 0) {
    cout << -1 << endl;
    return;
  }
  vector<pair<int, pair<int, int> > > rez;
  for (int i = 1; i < n; i++) {
    int index = i + 1;
    if (a[i] % index != 0) {
      rez.push_back(make_pair(index - (a[i] % index), make_pair(1, index)));
      a[i] += index - (a[i] % index);
    }
    rez.push_back(make_pair(a[i] / index, make_pair(index, 1)));
  }
  for (int i = 1; i < n; i++) {
    int index = i + 1;
    rez.push_back(make_pair(s / n, make_pair(1, index)));
  }
  cout << rez.size() << endl;
  for (int i = 0; i < rez.size(); i++) {
    cout << rez[i].second.first << " " << rez[i].second.second << " "
         << rez[i].first << endl;
  }
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    Main();
  }
}
