#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> ar(n);
  long long sum = 0;
  for (auto &i : ar) {
    cin >> i;
    sum += i;
  }
  if (sum % n != 0) {
    cout << -1 << "\n";
    return;
  }
  cout << 3 * n - 3 << "\n";
  for (long long i = 1; i < n; i++) {
    long long k = i + 1;
    long long x = (k - ar[i] % k) % k;
    cout << 1 << " " << k << " " << x << "\n";
    cout << k << " " << 1 << " " << (ar[i] + x) / k << "\n";
  }
  for (long long i = 1; i < n; i++) {
    long long k = i + 1;
    cout << 1 << " " << k << " " << sum / n << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
