#include <bits/stdc++.h>
using namespace std;
long long cd, res[300005][4], a[300005], kq[300005], mx[300005], pre[300005];
pair<int, int> b[300005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int cnt = 0;
    long long s = 0;
    cin >> cd;
    for (int i = 1; i <= cd; i++) {
      cin >> a[i];
      s += a[i];
    }
    if (s % cd != 0) {
      cout << -1 << '\n';
    } else {
      long long k = s / cd;
      for (int i = 2; i <= cd; i++) {
        if (a[i] % i == 0) {
          cnt++;
          res[cnt][1] = i;
          res[cnt][2] = 1;
          res[cnt][3] = a[i] / i;
          a[1] += a[i];
          a[i] = 0;
        } else {
          cnt++;
          res[cnt][1] = 1;
          res[cnt][2] = i;
          res[cnt][3] = i - (a[i] % i);
          a[1] -= (i - (a[i] % i));
          a[i] += (i - (a[i] % i));
          cnt++;
          res[cnt][1] = i;
          res[cnt][2] = 1;
          res[cnt][3] = a[i] / i;
        }
      }
      for (int i = 2; i <= cd; i++) {
        cnt++;
        res[cnt][1] = 1;
        res[cnt][2] = i;
        res[cnt][3] = k;
      }
      cout << cnt << '\n';
      for (int i = 1; i <= cnt; i++) {
        for (int e = 1; e <= 3; e++) cout << res[i][e] << " ";
        cout << '\n';
      }
    }
  }
}
