#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 5;
const int oo = INT_MAX;
const long long OO = LLONG_MAX;
long long t, n, a[maxN];
long long s, avg, X;
vector<pair<pair<int, int>, int>> k;
void solve() {
  if (s % n) {
    cout << -1 << '\n';
    return;
  }
  k.clear();
  avg = s / n;
  for (int i = (2); i <= int(n); ++i) {
    if (a[i] % i) {
      k.push_back({{1, i}, i - a[i] % i});
      a[i] += i - a[i] % i;
    }
    k.push_back({{i, 1}, a[i] / i});
  }
  for (int i = (2); i <= int(n); ++i) {
    k.push_back({{1, i}, avg});
  }
  cout << k.size() << '\n';
  for (auto v : k) {
    cout << v.first.first << ' ' << v.first.second << ' ' << v.second << '\n';
  }
}
void input() {
  cin >> n;
  s = 0;
  for (int i = (1); i <= int(n); ++i) {
    cin >> a[i];
    s += a[i];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    input();
    solve();
  }
}
