#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 5;
int a[maxn];
int main() {
  int t;
  int n;
  int k;
  int sum;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    sum = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      sum += a[i];
    }
    if (sum % n) {
      cout << -1 << endl;
      continue;
    }
    k = sum / n;
    printf("%d\n", 3 * n - 3);
    for (int i = 2; i <= n; i++) {
      if (a[i] % i == 0) {
        printf("1 %d 0\n", i);
        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, k);
    }
  }
  return 0;
}
