#include <bits/stdc++.h>
using namespace std;
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 << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
int n, a[10010], sc;
signed main() {
  int T = read();
  while (T--) {
    sc = 0;
    n = read();
    for (int i = 1; i <= n; i++) a[i] = read(), sc += a[i];
    if (sc % n)
      printf("-1\n");
    else {
      printf("%d\n", (n - 1) * 3);
      for (int i = 2; i <= n; i++)
        printf("1 %d %d\n%d 1 %d\n", i, (i - a[i] % i) % i, i,
               (a[i] + (i - a[i] % i) % i) / i);
      for (int i = 2; i <= n; i++) printf("1 %d %d\n", i, sc / n);
    }
  }
  return 0;
}
