#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long a[n + 1], sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i + 1];
    sum += a[i + 1];
  }
  if (sum % n) {
    cout << -1 << endl;
    return;
  }
  cout << (n - 1) * 3 << endl;
  long long m = sum / n;
  for (long long i = 2; i <= n; i++) {
    cout << "1 " << i << ' ' << (a[i] % i == 0 ? 0 : i - a[i] % i) << endl;
    cout << i << " 1 " << (a[i] / i + (a[i] % i == 0 ? 0 : 1)) << endl;
  }
  for (long long i = 2; i <= n; i++) {
    cout << "1 " << i << ' ' << m << endl;
  }
}
int32_t main() {
  long long t;
  cin >> t;
  while (t--) solve();
}
