#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAXN = (int)1e6 + 6;
int T;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    int a[N + 5];
    long long s = 0;
    for (int i = 1; i <= N; ++i) {
      cin >> a[i];
      s += (long long)a[i];
    }
    if (s % N != 0) {
      cout << "-1\n";
      continue;
    }
    vector<vector<int> > operation;
    operation.clear();
    for (int i = 2; i <= N; ++i) {
      if (a[i] % i == 0) {
        operation.push_back({i, 1, a[i] / i});
      } else {
        operation.push_back({1, i, i - a[i] % i});
        operation.push_back({i, 1, (int)ceil((double)a[i] / (double)i)});
      }
    }
    for (int i = 2; i <= N; ++i) {
      operation.push_back({1, i, (int)s / N});
    }
    cout << (int)operation.size() << '\n';
    for (int i = 0; i < (int)operation.size(); ++i) {
      for (int j = 0; j < (int)operation[i].size(); ++j) {
        cout << operation[i][j] << " ";
      }
      cout << '\n';
    }
  }
  return 0;
}
