#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
struct point {
  long long int x, y;
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tests;
  cin >> tests;
  for (long long int gg = 0; gg < tests; gg++) {
    long long int n;
    cin >> n;
    vector<long long int> arr(n);
    long long int sum = 0;
    for (long long int i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
    }
    if (sum % n != 0) {
      cout << "-1\n";
      continue;
    }
    long long int num = sum / n;
    vector<long long int> v1, v2, v3;
    for (long long int i = 1; i < n; i++) {
      if (arr[i] % (i + 1) == 0) {
        v1.push_back(i + 1);
        v2.push_back(1);
        v3.push_back(arr[i] / (i + 1));
        arr[i] = 0;
        arr[0] += arr[i];
        continue;
      }
      long long int x = (i + 1) - arr[i] % (i + 1);
      v1.push_back(1);
      v2.push_back(i + 1);
      v3.push_back(x);
      arr[i] += x;
      arr[0] -= x;
      x = arr[i] / (i + 1);
      v1.push_back(i + 1);
      v2.push_back(1);
      v3.push_back(x);
      arr[i] = 0;
      arr[0] += arr[i];
    }
    for (long long int i = 1; i < n; i++) {
      v1.push_back(1);
      v2.push_back(i + 1);
      v3.push_back(num);
    }
    cout << v1.size() << "\n";
    for (long long int i = 0; i < v1.size(); i++) {
      cout << v1[i] << " " << v2[i] << " " << v3[i] << "\n";
    }
  }
}
