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