#include <bits/stdc++.h>
using namespace std;
int main() {
  long long e, n, i, s, t, p;
  cin >> e;
  while (e--) {
    s = 0;
    cin >> n;
    long a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
      s = s + a[i];
    }
    if (s % n == 0) {
      t = s / n;
      cout << 3 * (n - 1) << "\n";
      for (i = 2; i <= n; i++) {
        p = (i - a[i - 1] % i) % i;
        cout << 1 << " " << i << " " << p << "\n";
        cout << i << " " << 1 << " " << (a[i - 1] + p) / i << "\n";
      }
      for (i = 2; i <= n; i++) {
        cout << 1 << " " << i << " " << t << "\n";
      }
    } else
      cout << "-1\n";
  }
}
