#include <bits/stdc++.h>
using namespace std;
long long i, j, k, m, n, p, s, t, a[10005], x[30018], y[30018], z[30018];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (cin >> t; t--;) {
    cin >> n;
    for (i = k = s = 0; i++ < n;) {
      cin >> a[i];
      s += a[i];
    }
    if (s % n) {
      cout << -1 << '\n';
      goto G;
    }
    s /= n;
    for (i = 1; i++ < n;) {
      p = (i - a[i] % i) % i;
      x[++k] = 1;
      y[k] = i;
      z[k] = p;
      a[1] -= p;
      a[i] += p;
      x[++k] = i;
      y[k] = 1;
      z[k] = a[i] / i;
    }
    for (i = 1; i++ < n;) {
      x[++k] = 1;
      y[k] = i;
      z[k] = s;
    }
    cout << k << '\n';
    for (i = 0; i++ < k;) cout << x[i] << ' ' << y[i] << ' ' << z[i] << '\n';
  G:;
  }
}
