#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
const int N = 1e4 + 10;
int a[N];
void run() {
  int sum = 0, cnt = 0;
  int n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    sum += a[i];
    if (a[i] % i) cnt++;
  }
  if (sum % n) {
    printf("-1\n");
    return;
  }
  int ave = sum / n;
  printf("%d\n", 2 * (n - 1) + cnt);
  for (int i = 2; i <= n; i++) {
    if (a[i] % i == 0) {
      printf("%d 1 %d\n", i, a[i] / i);
    } else {
      printf("1 %d %d\n", i, i - a[i] % i);
      printf("%d 1 %d\n", i, a[i] / i + 1);
    }
  }
  for (int i = 2; i <= n; i++) {
    printf("1 %d %d\n", i, ave);
  }
}
int main() {
  int _T = read();
  while (_T--) run();
  return 0;
}
